3d scatter plot [message #642] |
Wed, 16 December 1992 17:17  |
li
Messages: 1 Registered: December 1992
|
Junior Member |
|
|
Hi,
I am a new user for pvwave. I am wondering if I can do a 3d scatter plot
in pvwave. Say, I have a 3d array (ie array[][][]), I want to put a
dot or whatever on the graph if array[][][] is greater than a certain
value. Thanks in advance
kelvin
(li@nuclear4.physics.utoronto.ca)
|
|
|
Re: 3D scatter plot [message #1024 is a reply to message #642] |
Tue, 25 May 1993 06:07   |
landers
Messages: 45 Registered: May 1993
|
Member |
|
|
If I understand what you want, you want to plot points in a 3-d plot
(perspective view). Thats pretty easy - you set up the axes, etc with
surface and use plots to make the plot, as in
WAVE> x = randomn(s,10)
WAVE> y = randomn(s,10)
WAVE> z = randomn(s,10)
WAVE> ; set axes and !p.t transformation by plotting a dummy array....
WAVE> surface,[[0,0],[0,0]], /NoData, xrange=[-3,3],yrange=[-3,3], /Save
WAVE> ; plot them points - don't forget the /t3d keyword or /save above
WAVE> plots, x, y, z, /t3d
The only problem with this is that it draws your symbols parallel to the XY
plane, and that may not be what you want.
If you want the symbols parallel to the plotting surface (i.e. your screen),
then transform them yourself something like this:
WAVE> surface,[[0,0],[0,0]], /NoData, xrange=[-3,3],yrange=[-3,3], /Save
WAVE> ; make normalized coords of your data
WAVE> unit = replicate(1., n_elements(x))
WAVE> xx = !X.S(0) + (!X.S(1) * x)
WAVE> yy = !Y.S(0) + (!Y.S(1) * y)
WAVE> zz = !Z.S(0) + (!Z.S(1) * z)
WAVE> ; transform using !p.t
WAVE> v = [ [xx], [yy], [zz], [unit] ] # !p.t
WAVE> ; back to data coords
WAVE> v(*,0) = ( v(*,0) - !x.s(0) ) / !x.s(1)
WAVE> v(*,1) = ( v(*,1) - !y.s(0) ) / !y.s(1)
WAVE> v(*,2) = ( v(*,2) - !z.s(0) ) / !z.s(1)
WAVE> ; now plot it - note NO /t3d keyword - make sure !p.t3d isn't set, too
WAVE> plots,transpose(v(*,0:2)),psym=1
Because this draws psyms parallel to your plot surface, they're more readable,
but it kinda looses some of the 3D-ishness that the simpler example had.
Hope this helps,
Dave
|
|
|
Re: 3D scatter plot [message #6414 is a reply to message #642] |
Thu, 13 June 1996 00:00   |
Bruce E Thomason
Messages: 6 Registered: March 1996
|
Junior Member |
|
|
Tom Hofstetter wrote:
>
> Hi. I can't figure out how to do a simple 3D scatter plot.
> I have 3 arrays, X, Y, and Z and I'd like to say:
>
> plot, x, y, z, psym=1
>
> and see plus signs "in space" so to speak.
>
> Is this possible?
In PV-Wave, use the user library routine "plot3d" as follows:
plot3d, x,y,z, linestyle=0, psym=1
not sure about IDL.
{!}
/~~~~~\....:
{(o)-(o)}
----------------------------------OOo----(_)----oOO--------- ---------
Dynamic System Solutions Real-Time System Developers
331 Franklin St. Specializing in Test, Measurement
Columbus, IN 47201 & Scientific Visualization
|
|
|
|
Re: 3D Scatter plot [message #13935 is a reply to message #642] |
Wed, 23 December 1998 00:00   |
David Borland
Messages: 6 Registered: December 1998
|
Junior Member |
|
|
Hellu,
An easy way of doing this is to include the psym keyword in the plot_3dbox
call. If you include this command with a positive integer between 1and 7 you
will get just the points drawn, if you use a negative integer between -1 and
-7, you will get the points and the lines drawn.
One way of getting a surface plot from x,y,z coordinates is to call
triangulate, which will give you daleany triangles for the object, and then
send that output to trigrid, which does something else to the data, and then
take that output and do a surface plot to it.
Ie. triangulate,image_x,image_y,angles
griddata=trigrid(image_x,image_y,image_z,angles)
surface,griddata
angles is where triangulate stores it's results.
If you want to see what triangulate has done, try this set of commands and it
will draw out the triangles for you.
triangulate,image_x,image_y,angles
for j=0,n_elements(angles[0,*])-1 do begin
t = [angles[*,j],angles[0,j]]
plots,image_x[t],image_y[t],image_z[t],/t3d,color='ff0000'x
A problem with this method is that if you are trying this on a 3D shape, you
will get lines that cross through the shape and make the surface plot look
wrong. I have not figured out how to fix this with built in IDl routines, so
I'm trying to write my own. If anyone knows a better way of doing this part,
I'd love to hear it.
--
David Borland
Electrical Geodesics Inc.
davidbor@cyber-dyne.com
"Patrick V. Ford" wrote:
> I want a 3D display of a set of data point that I have imported from a
> SYLK file. I have extracted from the SYLK structure the X, Y and Z
> coordinates, where each is an array of 117 float. I get close to what I
> want with a plot-3dbox function, but because of the way it is formatted it
> looks like a series of switch-back paths. What I would really like is a
> surface plot, but I failed at my attempt to use these functions. It is
> also obvious that I don't have a clue on how to set the exponential
> parameter in KRIG2D. I know there must be some trivial method to do this
> in IDL.
>
> Thanks in advance.
>
> Patrick Ford, MD
> Baylor College of Medicine
> pford@bcm.tmc.edu
|
|
|
Re: 3D Scatter Plot [message #48210 is a reply to message #642] |
Thu, 06 April 2006 13:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
aecorner@yahoo.com writes:
> I tried out your usersym commands and they don't fill.
Say what!? Mine fill, always. :-)
> I had actually
> tried defining my own before with the /FILL option and no luck then
> either. I wonder why the symbols are horizontal only. It seems for a
> 3D plot you want the ability to make the vertexes 3D as well.
If you want a 3D plot, you *really* don't want to be
working in IDL direct graphics. The best you will ever
get there is 2.5D. :-)
> My map is a little wonky still, but it is getting there.
Progress is always inch by inch with IDL.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: 3D Scatter Plot [message #48212 is a reply to message #642] |
Thu, 06 April 2006 13:09  |
aecorner
Messages: 2 Registered: April 2006
|
Junior Member |
|
|
Thank you very much for your help.
I tried out your usersym commands and they don't fill. I had actually
tried defining my own before with the /FILL option and no luck then
either. I wonder why the symbols are horizontal only. It seems for a
3D plot you want the ability to make the vertexes 3D as well.
My map is a little wonky still, but it is getting there.
Thanks,
Amy
|
|
|
|
Re: 3D Scatter Plot [message #48216 is a reply to message #642] |
Thu, 06 April 2006 09:39  |
ChiChiRuiz@gmail.com
Messages: 32 Registered: October 2005
|
Member |
|
|
I have a question related to that. I also have to perform a 3D scatter
plot, what else do I need to add in order to retate the axes (like in
ENVI the n-dim visual tool)? Thanks.
-Angie
|
|
|
Re: 3D Scatter Plot [message #48217 is a reply to message #642] |
Thu, 06 April 2006 08:59  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
aecorner@yahoo.com writes:
> I created a 3D scatter plot (long, lat, alt) for some satellite data
> (using the very helpful tips on David Fanning's website). A few
> questions...
I noticed in reading this article again that it had gotten
pretty long in the tooth. I've made a couple of updates
to allow it to work with modern computers, and while I was
at it, I added a section on putting a 3D scatter plot on
top of a map projection. This was *slightly* more complicated
than I expected it to be for reasons that completely mystify
me, although I'm satisfied that Map_Set is doing the damage.
Anyway, the problem was pretty easy to work around.
http://www.dfanning.com/tips/scatter3d.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: 3D Scatter Plot [message #48218 is a reply to message #642] |
Thu, 06 April 2006 07:12  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
aecorner@yahoo.com writes:
> I created a 3D scatter plot (long, lat, alt) for some satellite data
> (using the very helpful tips on David Fanning's website). A few
> questions...
>
> 1) Is there a way to fill in the symbols? This seems like it should
> be obvious.
Create a filled symbol and use that. Here, for example, is
how to create and use a filled circle:
phi = Findgen(32) * (!PI * 2 / 32.)
phi = [ phi, phi(0) ]
UserSym, Cos(phi), Sin(phi), /Fill
PLOTS, x, y, z, PSYM=8, COLOR=zcolors, SYMSIZE=2.5, /T3D
> 2) I need each point to be a different color based on it's Aerosol
> Optical Depth. I created an array of the color that each point needs
> to be. Can I set the COLOR keyword equal to this array in the PLOTS
> procedure to achieve that result?
A empirical exercise for the user. :-)
> 3) Is there a way to display a 3D plot on a map projection? The x and
> y axes are longitude and latitude and I would like to slip a map in
> horizontally along the bottom of the plot.
Yes, sort of. Set up your 3D coordinate space, then warp your
map projection into that space by setting the T3D keyword. But
you are pushing the limits of direct graphics. You might want to
make a foray into object graphics if you want to push this project
much further. It adds another order of magnitude in complexity,
but the results will be better, for sure.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|