comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » 3d scatter plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: 3D scatter plot [message #1024 is a reply to message #642] Tue, 25 May 1993 06:07 Go to previous messageGo to previous message
landers is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Anything in IDL like R's Copy to Clipboard As a Metafile?
Next Topic: populating an array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:21:45 PDT 2025

Total time taken to generate the page: 0.72052 seconds