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

Home » Public Forums » archive » using cgSurface to produce a scatter 3D plot with 4th dimension
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
using cgSurface to produce a scatter 3D plot with 4th dimension [message #79527] Wed, 07 March 2012 03:16 Go to next message
Sebastian Schäfer is currently offline  Sebastian Schäfer
Messages: 7
Registered: March 2012
Junior Member
Hi,

I have a datacube like this and two arrays with the values for the 3
axes
L1 DOUBLE = Array[100]
L2 DOUBLE = Array[100]
SINF DOUBLE = Array[100]
XI2MAP DOUBLE = Array[100, 100, 100]

I select a number of points using where() and now want to create a 3D
plot of these points and use the color to represent their value. I
managed to do this with cgsurf:



max_xi = 800
select = where(xi2map LT max_xi,count)
WhereToMulti, xi2map, select, Col, Row, Frame
xi2 = xi2map[col,row,frame]
symColors = Fix(BytScl(xi2))

cgLoadCT, 3
cgSurf,
dist(100),l1,l2,xrange=[min(l1),max(l1)],yrange=[min(l2),max (l2)],zrange=[min(sinf),max(sinf)],xstyle=1,ystyle=1,$
/NoErase, xtitle='lambda_1',ytitle='lambda_2',ztitle='stability',/
nodata,/window,/save

cgAxis,XAxis=1,/T3D,XStyle=1,/window
cgAxis,YAxis=1,/T3D,YStyle=1,/window
cgAxis,ZAxis=0,/T3D,max(l1),min(l2),/window
cgAxis,ZAxis=0,/T3D,max(l1),max(l2),/window

cgColorbar, Divisions=4, Minor=5, Format='(F0.2)',
Range=[min(xi2map[select]), max(xi2map[select])],title='Xi2',/add

cgControl, Execute=0
FOR i=0,count-1 DO BEGIN
cgplots,[l1[col[i]],l1[col[i]]],[l2[row[i]],l2[row[i]]],
[sinf[frame[i]],min(sinf)],color=cgcolor('light gray')$
, /T3d,/add
ENDFOR

FOR i=0, count-1 DO BEGIN
cgplots,l1[col[i]],l2[row[i]],min(sinf),/
t3d,psym=3,symsize=1.0,color=cgColor('black'),/add
ENDFOR

FOR i=0, count-1 DO BEGIN
cgplots,l1[col[i]],l2[row[i]],sinf[frame[i]],/
t3d,psym=symcat(16),symsize=2,color=cgColor(StrTrim(symcolor s[i],2)),/
add
ENDFOR
cgControl, Execute=1


that's pretty much how David Fanning explained it in his traditional
grafics book (pages 185-197). Now I am trying to get this working with
cgsurface so I can rotate and zoom mi xi2 map. Is this even possible
with cgsurface since it only accepts the data in 2D?
Re: using cgSurface to produce a scatter 3D plot with 4th dimension [message #79594 is a reply to message #79527] Fri, 09 March 2012 06:37 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sebastian Schäfer writes:

> True, but I have 4 dimensions x,y,z,f(x,y,z) and Scatter_Surface only
> accepts 3 so there is no way I can plot my data with that program. One
> would need to extend Scatter_surface in order to do that (which I
> can't), and as I said, that's two lines in gnuplot (4D, not 3D).

Well, really, this is a 30 second fix. But, I'm on my
way to Hawaii and can't be bothered today! Maybe I'll
work on this when I get back. Can't have gnuplot doing
things IDL doesn't. ;-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: using cgSurface to produce a scatter 3D plot with 4th dimension [message #79596 is a reply to message #79527] Fri, 09 March 2012 06:22 Go to previous message
Sebastian Schäfer is currently offline  Sebastian Schäfer
Messages: 7
Registered: March 2012
Junior Member
On 9 Mrz., 14:25, David Fanning <n...@idlcoyote.com> wrote:

> That simple program does "elevation shading" (i.e., in the
> Z direction) by default, just like in your example.

True, but I have 4 dimensions x,y,z,f(x,y,z) and Scatter_Surface only
accepts 3 so there is no way I can plot my data with that program. One
would need to extend Scatter_surface in order to do that (which I
can't), and as I said, that's two lines in gnuplot (4D, not 3D).
Re: using cgSurface to produce a scatter 3D plot with 4th dimension [message #79598 is a reply to message #79527] Fri, 09 March 2012 05:25 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sebastian Schäfer writes:

> I did - but Scatter_Surface only accepts 3 dimensions (e.g. x,y and a
> value for each point: z). Unfortunately, I have 4 dimensions: 3
> coordinates (x,y,z) and one value for each of these points. What is
> missing is the option to use the color of the symbols plotted to
> visualize the 4th dimension (like I did with cgSurf) or am I
> overlooking something?

That simple program does "elevation shading" (i.e., in the
Z direction) by default, just like in your example.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Black screen movie
Next Topic: Re: Question about storing arrays in pointer array.

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

Current Time: Wed Oct 08 14:00:14 PDT 2025

Total time taken to generate the page: 0.00579 seconds