[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: Plotting a 3D Array In IDL*From*: Paul van Delst <paul.vandelst(at)noaa.gov>*Date*: Thu, 19 Jul 2001 10:16:54 -0400*Newsgroups*: comp.lang.idl-pvwave*Organization*: CIMSS @ NOAA/NCEP*References*: <Fg457.13756$p7.4797223@news1.rdc2.pa.home.com> <3B55B73C.4542E962@ccpo.odu.edu>*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:25762

eddie haskell wrote: > > > Say I have a 3D array whose elements are only 1 or 0. I'd like to plot > > this array, say a white dot for the 1's and a red dot for the 0's. Is there > > a way I can do this in IDL? > > Below is a program fragment that does what I think you want done. There might > be a slick one line way of doing it or maybe something visually stunning using > object graphics but nothing currently leaps to mind. > > Cheers, > eddie > > ;-------------------------- > n = 4 > a = randomu(seed,n,n,n) gt 0.5 > surface, dist(n), /nodata, zr=[0,n-1], /save > tvlct,[0,255],[255,0],[0,0],1 > > for j = 0,1 do begin > wh = where(a eq j) > x = wh mod n > y = wh / n mod n > z = wh / n^2 > for i = 0, n_elements(wh)-1 do $ > plots,x[i],y[i],z[i],/t3d,psym=2,color=j+1 > endfor > ;----------------------- Cool - I couldn't figure out how to do it. I modified the above a little to use plot3d n = 4 a = randomu(seed,n,n,n) gt 0.5 tvlct,[0,255],[255,0],[0,0],1 for j = 0,1 do begin wh = where(a eq j) x = wh mod n y = wh / n mod n z = wh / n^2 plot3d, x,y,z,psym=2,color=j+1,oplot=j endfor but I find the resultant plot hard to interpret. I think this is a case where object graphics is required to give some depth to the plot by varying the size of the plotting symbols with perceived depth... or something like that. paulv -- Paul van Delst A little learning is a dangerous thing; CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring; Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain, Fax:(301)763-8545 And drinking largely sobers us again. Alexander Pope.

**References**:**Plotting a 3D Array In IDL***From:*K. Banerjee

**Re: Plotting a 3D Array In IDL***From:*eddie haskell

- Prev by Date:
**Re: emacs idlwave shell key bindings** - Next by Date:
**How to get PV-Wave to exit automatically when no license** - Prev by thread:
**Re: Plotting a 3D Array In IDL** - Next by thread:
**emacs idlwave shell key bindings** - Index(es):