3D plotting [message #748] |
Mon, 19 October 1992 14:31  |
dere
Messages: 4 Registered: October 1992
|
Junior Member |
|
|
I have been trying to do some 3D plotting using the Surface routine and then using Contour and Plots. However, the two do not seem to share the same coordinate system. Any ideas?
|
|
|
Re: 3D plotting [message #51177 is a reply to message #748] |
Wed, 08 November 2006 07:05   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Eric writes:
> I'm trying to find the most efficient way to make a 3D plot. I'm
> going into my plot code with 5 variables, r_x, r_y, r_z, count and
> color_scale.
>
> r_x, r_y and r_z are arrays with the data points, count is the number
> of points to plot and color_scale is an array of colors for each point.
> The way I'm doing it right now (using XPLOT3D) is taking A LONG time
> to plot (around 230 data points) and is also very difficult to rotate
> the plot the way I want after it is already created. I tried using
> iPlot, but it doesn't seem to like me using an array with a color
> from a color table (it seems to prefer RGB?). Is there a way of doing
> this in iPlot? Any other suggestions are welcome as well.
I managed to get color working by doing something like this:
zcolors = BytScl(z)
thisPalette = Obj_New('IDLgrPalette')
thisPalette->LoadCT, 5
thisPalette->GetProperty, Red=r, Green=g, Blue=b
Obj_Destroy, thisPalette
; Create the symbols for each point.
npts = N_Elements(x)
theseSymbols=ObjArr(npts)
FOR j=0,npts-1 DO BEGIN
oOrb = obj_new('RHTgrPSolid', /TETRAHEDRON, $
Color=[r[zcolors[j]], g[zcolors[j]], b[zcolors[j]]])
theseSymbols[j] = OBJ_NEW('IDLgrSymbol', oOrb, $
Size=[0.05, 0.05, 0.05])
ENDFOR
; Create Polyline object..
thisPolyline = OBJ_NEW('IDLgrPolyline', x, y, z, $
LineStyle=6, Symbol=theseSymbols)
You can find the complete program here
http://www.dfanning.com/misc/scatter_surface.pro
I tried it with 300 points and it seems to rotate OK.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: 3D plotting [message #51290 is a reply to message #51177] |
Wed, 08 November 2006 23:46  |
eric :)
Messages: 3 Registered: November 2006
|
Junior Member |
|
|
wow, i had no idea you could make an array of objects. that fixed
everything
thanks a lot!
Eric
David Fanning wrote:
> Eric writes:
>
>> I'm trying to find the most efficient way to make a 3D plot. I'm
>> going into my plot code with 5 variables, r_x, r_y, r_z, count and
>> color_scale.
>>
>> r_x, r_y and r_z are arrays with the data points, count is the number
>> of points to plot and color_scale is an array of colors for each point.
>> The way I'm doing it right now (using XPLOT3D) is taking A LONG time
>> to plot (around 230 data points) and is also very difficult to rotate
>> the plot the way I want after it is already created. I tried using
>> iPlot, but it doesn't seem to like me using an array with a color
>> from a color table (it seems to prefer RGB?). Is there a way of doing
>> this in iPlot? Any other suggestions are welcome as well.
>
> I managed to get color working by doing something like this:
>
> zcolors = BytScl(z)
> thisPalette = Obj_New('IDLgrPalette')
> thisPalette->LoadCT, 5
> thisPalette->GetProperty, Red=r, Green=g, Blue=b
> Obj_Destroy, thisPalette
>
> ; Create the symbols for each point.
> npts = N_Elements(x)
> theseSymbols=ObjArr(npts)
> FOR j=0,npts-1 DO BEGIN
>
> oOrb = obj_new('RHTgrPSolid', /TETRAHEDRON, $
> Color=[r[zcolors[j]], g[zcolors[j]], b[zcolors[j]]])
> theseSymbols[j] = OBJ_NEW('IDLgrSymbol', oOrb, $
> Size=[0.05, 0.05, 0.05])
> ENDFOR
>
> ; Create Polyline object..
> thisPolyline = OBJ_NEW('IDLgrPolyline', x, y, z, $
> LineStyle=6, Symbol=theseSymbols)
>
>
>
> You can find the complete program here
>
> http://www.dfanning.com/misc/scatter_surface.pro
>
> I tried it with 300 points and it seems to rotate OK.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|