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

Home » Public Forums » archive » Plotting a 3D Array In IDL
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: Plotting a 3D Array In IDL [message #25863 is a reply to message #25778] Wed, 18 July 2001 09:20 Go to previous messageGo to previous message
eddie haskell is currently offline  eddie haskell
Messages: 29
Registered: September 1998
Junior Member
> 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
;-----------------------

------------------------------------------
A G Edward Haskell
Center for Coastal Physical Oceanography
Old Dominion University, Norfolk VA 23529
e-mail haskell*ccpo.odu.edu
------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: emacs idlwave shell key bindings
Next Topic: How to get PV-Wave to exit automatically when no license

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

Current Time: Mon Oct 20 04:15:13 PDT 2025

Total time taken to generate the page: 5.36093 seconds