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

Home » Public Forums » archive » Re: 3-D scatter plot routines?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: 3-D scatter plot routines? [message #9220] Thu, 05 June 1997 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Dan Peduzzi writes:

> I have many points of the form (x,y,z) which I would like
> to display using IDL. Ultimately, I would like to fit a
> surface to these data, but because they do not conform to
> any grid, I don't think I can use the SFIT procedure (which
> requires a 2-D array of data to fit.)
>
> Do I have any other options, using IDL 3.5?

Typically, XYZ points must be gridded to a 2D array
to be displayed with the Surface command. This is usually
done with the Triangulate and Trigrid procedures.

Here is an example program from my soon (thank goodness!)
to be complete book that might give you an idea of how this
is done.

Cheers,

David

************************************************************ *****


; Create the random data. Set the seed so you see what I see.

seed = 1L
x = RANDOMU(seed, 32)
y = RANDOMU(seed, 32)
z = EXP(-3 * ((x - 0.5)^2 + (y - 0.5)^2))

; Load a color table and create colors for the scatterplot.

LOADCT, 38, NCOLORS=!D.N_COLORS-2
TVLCT, [70,255], [70,255], [70,0], !D.N_COLORS-2
zcolors = BYTSCL(z, TOP=!D.N_COLORS-3)

; Set up side-by-side viewing.

WINDOW, /Free, XSize=700, YSize=450
!P.MULTI = [0,2,1]

; Set the 3D coordinate space with axes.

SURFACE, DIST(5), /NODATA, /SAVE, XRANGE=[0,1], $
YRANGE=[0,1], ZRANGE=[0, 1], XSTYLE=1, $
YSTYLE=1, ZSTYLE=1, CHARSIZE=1.5, COLOR=!D.N_COLORS-1, $
BACKGROUND=!D.N_COLORS-2

; Plot the random points in 3D space with a diamond shape.

PLOTS, x, y, z, PSYM=4, COLOR=zcolors, SYMSIZE=2.5, /T3D

; Connect the data points to the XY plane of the plot.

FOR j=0,31 DO PLOTS, [x(j), x(j)], [y(j), y(j)], [0, z(j)], $
COLOR=zcolors(j), /T3D

; Now grid the data so you can display a surface on top.

Triangulate, x, y, triangles
thisSurface = TriGrid(x, y, z, triangles, /Smooth)
s = SIZE(thisSurface)
xx = Findgen(s(1))/(s(1)-1)
yy = Findgen(s(2))/(s(2)-1)

SURFACE, thisSurface, xx, yy, CHARSIZE=1.5, $
COLOR=!D.N_COLORS-1, ZRANGE=[0,1]

!P.MULTI = 0

END
************************************************************ ***

David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
Re: 3-D scatter plot routines? [message #9222 is a reply to message #9220] Thu, 05 June 1997 00:00 Go to previous message
Harald Frey is currently offline  Harald Frey
Messages: 41
Registered: March 1997
Member
Dan Peduzzi wrote:
>
> I have many points of the form (x,y,z) which I would like
> to display using IDL. Ultimately, I would like to fit a
> surface to these data, but because they do not conform to
> any grid, I don't think I can use the SFIT procedure (which
> requires a 2-D array of data to fit.)
>

Use the IDL procedure slicer.

Harald Frey
Space Sciences Laboratory
University of California
Berkeley, CA 94720
hfrey@ssl.berkeley.edu
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MAP_SET error: linux
Next Topic: 3-D scatter plot routines?

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

Current Time: Wed Oct 08 13:39:25 PDT 2025

Total time taken to generate the page: 0.00628 seconds