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

Home » Public Forums » archive » Re: how to draw three-dimension graph using 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: how to draw three-dimension graph using IDL [message #43661 is a reply to message #43652] Tue, 19 April 2005 08:54 Go to previous messageGo to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
lixiaoyao wrote:
> thank you so much,you are so powerful.
> Paolo Grigis wrote:
>
>> for a surface, you could try:
>>
>> x=4*!pi*findgen(101)/100
>> y=4*!pi*findgen(101)/100
>>
>> xx=rebin(x,n_elements(x),n_elements(y))
>> yy=rebin(transpose(y),n_elements(x),n_elements(y))
>
> why does there need to transpose? I am a little bit confuse.
Well, of course you have to try to understand the code
for yourself, the best way to do it is to try out with
a simple example:

x=[1,2,3]
y=[1,2,3]

xx=rebin(x,n_elements(x),n_elements(y))
yy=rebin(transpose(y),n_elements(x),n_elements(y))

IDL> print,xx
1 2 3
1 2 3
1 2 3
IDL> print,yy
1 1 1
2 2 2
3 3 3
(you see why I had to transpose to get yy?)

IDL> z=xx+yy
IDL> print,z
2 3 4
3 4 5
4 5 6


Now z[i,j] is equal to x[i]+y[j], and the "rebin" call
was used to inflate the x and y array in order to avoid
the need of writing two nested for loops over i and j
to fill out the values of z[i,j]=x[i]+y[j].

Paolo


>
>> shade_surf,sin(xx)*sin(yy),xx,yy
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: how to get the data from the contour line?
Next Topic: Inverse CWT

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

Current Time: Sun Oct 12 04:49:51 PDT 2025

Total time taken to generate the page: 0.96223 seconds