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

Home » Public Forums » archive » Re: 2D Plot in IDL with shading?
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: 2D Plot in IDL with shading? [message #71419] Mon, 21 June 2010 11:41 Go to next message
Ally is currently offline  Ally
Messages: 13
Registered: June 2010
Junior Member
On Jun 21, 11:14 am, pp <pp.pente...@gmail.com> wrote:
> On Jun 21, 12:09 pm, Ally <ally.desh...@gmail.com> wrote:
>
>> Great, that's exactly what I needed! I'm working on creating it right
>> now.  Out of curiosity, is there any way to make a graph like that in
>> 2D to start with, without a z-axis and just response plotted in color
>> vs azimuth and elevation?
>
> That is what would be called an image, which can be made with
>
> iimage,response,elevation,azimuth

I keep trying but can't seem to get isurface to graph it. I may be
missing something basic but I've been reading through different
examples and can't figure it out. Here is what I have:

rows = 5273670
OPENR, lun1, 'ss_raw_06.dat', /GET_LUN
data = DBLARR(2,rows)
READF, lun1, data
response= data(1,*)

OPENR, lun2, 'az.dat', /GET_LUN
data2=DBLARR(2, rows)
READF, lun2, data2
az_g= data2(1,*)

OPENR, lun3, 'sun_el_and_az.dat', /GET_LUN
data3=DBLARR(2,rows)
READF, lun3, data3
az_s=data3(1,*)
elevation=data3(0,*)

azimuth=(az_s)-(az_g)

isurface, response, elevation, azimuth



It runs fine and the iSurface tool opens, there's just nothing
graphed.
Re: 2D Plot in IDL with shading? [message #71424 is a reply to message #71419] Mon, 21 June 2010 08:14 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 21, 12:09 pm, Ally <ally.desh...@gmail.com> wrote:
> Great, that's exactly what I needed! I'm working on creating it right
> now.  Out of curiosity, is there any way to make a graph like that in
> 2D to start with, without a z-axis and just response plotted in color
> vs azimuth and elevation?

That is what would be called an image, which can be made with

iimage,response,elevation,azimuth
Re: 2D Plot in IDL with shading? [message #71425 is a reply to message #71424] Mon, 21 June 2010 08:09 Go to previous messageGo to next message
Ally is currently offline  Ally
Messages: 13
Registered: June 2010
Junior Member
On Jun 18, 4:34 pm, David Fanning <n...@dfanning.com> wrote:
> pp writes:
>> Though you could have made a surface, with
>
>> isurface,response,elevation,azimuth
>
> Yes, I think that is right. Here is a 3D elevation
> shaded surface, rotated with FSC_Surface so that
> the Z axis comes directly out of the page toward
> the viewer. Took about 10 seconds to create. :-)
>
>   http://www.dfanning.com/misc/fsc_surface.png
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Great, that's exactly what I needed! I'm working on creating it right
now. Out of curiosity, is there any way to make a graph like that in
2D to start with, without a z-axis and just response plotted in color
vs azimuth and elevation?

Best,
Allison
Re: 2D Plot in IDL with shading? [message #71426 is a reply to message #71425] Mon, 21 June 2010 08:09 Go to previous messageGo to next message
Ally is currently offline  Ally
Messages: 13
Registered: June 2010
Junior Member
On Jun 18, 4:34 pm, David Fanning <n...@dfanning.com> wrote:
> pp writes:
>> Though you could have made a surface, with
>
>> isurface,response,elevation,azimuth
>
> Yes, I think that is right. Here is a 3D elevation
> shaded surface, rotated with FSC_Surface so that
> the Z axis comes directly out of the page toward
> the viewer. Took about 10 seconds to create. :-)
>
>   http://www.dfanning.com/misc/fsc_surface.png
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Great, that's exactly what I needed! I'm working on creating it right
now. Out of curiosity, is there any way to make a graph like that in
2D to start with, without a z-axis and just response plotted in color
vs azimuth and elevation?

Best,
Allison
Re: 2D Plot in IDL with shading? [message #71445 is a reply to message #71426] Fri, 18 June 2010 13:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> Though you could have made a surface, with
>
> isurface,response,elevation,azimuth

Yes, I think that is right. Here is a 3D elevation
shaded surface, rotated with FSC_Surface so that
the Z axis comes directly out of the page toward
the viewer. Took about 10 seconds to create. :-)

http://www.dfanning.com/misc/fsc_surface.png

Cheers,

David





--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: 2D Plot in IDL with shading? [message #71446 is a reply to message #71445] Fri, 18 June 2010 13:30 Go to previous messageGo to next message
Ally is currently offline  Ally
Messages: 13
Registered: June 2010
Junior Member
On Jun 18, 4:16 pm, pp <pp.pente...@gmail.com> wrote:
> On Jun 18, 5:11 pm, Ally <ally.desh...@gmail.com> wrote:
>
>> Not exactly.  The whole plot will be filled in because there's a diode
>> response for each elevation and azimuth pair.  The diode response
>> doesn't change linearly so I can't use the vector idea.  I want the
>> colors to match the data in highest to lowest value order (or vice
>> versa) but the data isn't written this way (it should end up looking
>> like a ring or ellipse pattern with greatest response/darkest color on
>> the outside and lowest response/lightest color on the inside).  I have
>> a picture of something similar in Python but I can't attach it to a
>> post.  Is there any way I can make a surface plot of the data, give it
>> elevation shading, and then just view it top down so I only see the x
>> and y axes and colored rings?
>
> I think what you want is just an image, something like:
>
> iimage,response,elevation,azimuth
>
> Though you could have made a surface, with
>
> isurface,response,elevation,azimuth
>
> Or a contour plot with
>
> icontour,response,elevation,azimuth

Thanks. I'll try those and see if it works.

-Allison
Re: 2D Plot in IDL with shading? [message #71447 is a reply to message #71446] Fri, 18 June 2010 13:16 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 18, 5:11 pm, Ally <ally.desh...@gmail.com> wrote:
> Not exactly.  The whole plot will be filled in because there's a diode
> response for each elevation and azimuth pair.  The diode response
> doesn't change linearly so I can't use the vector idea.  I want the
> colors to match the data in highest to lowest value order (or vice
> versa) but the data isn't written this way (it should end up looking
> like a ring or ellipse pattern with greatest response/darkest color on
> the outside and lowest response/lightest color on the inside).  I have
> a picture of something similar in Python but I can't attach it to a
> post.  Is there any way I can make a surface plot of the data, give it
> elevation shading, and then just view it top down so I only see the x
> and y axes and colored rings?

I think what you want is just an image, something like:

iimage,response,elevation,azimuth

Though you could have made a surface, with

isurface,response,elevation,azimuth

Or a contour plot with

icontour,response,elevation,azimuth
Re: 2D Plot in IDL with shading? [message #71448 is a reply to message #71447] Fri, 18 June 2010 13:11 Go to previous messageGo to next message
Ally is currently offline  Ally
Messages: 13
Registered: June 2010
Junior Member
On Jun 18, 3:49 pm, David Fanning <n...@dfanning.com> wrote:
> Ally writes:
>> I have three arrays-sun elevation, azimuth, and diode response, for
>> each of 12 sun sensors and I'm trying to create a 2D plot in IDL with
>> elevation on the x-axis, azimuth on the y-axis and the diode response
>> color coded on a gradient scale.  It would kind of be like a birds-eye
>> view of what a 3D graph with elevation shading would look like.  I've
>> been searching for two days now and can't seem to find anything online
>> that shows me how to make a graph like this.  Any help is appreciated.
>
> Are you looking for something like this:
>
>   http://www.dfanning.com/graphics_tips/coloredline.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Not exactly. The whole plot will be filled in because there's a diode
response for each elevation and azimuth pair. The diode response
doesn't change linearly so I can't use the vector idea. I want the
colors to match the data in highest to lowest value order (or vice
versa) but the data isn't written this way (it should end up looking
like a ring or ellipse pattern with greatest response/darkest color on
the outside and lowest response/lightest color on the inside). I have
a picture of something similar in Python but I can't attach it to a
post. Is there any way I can make a surface plot of the data, give it
elevation shading, and then just view it top down so I only see the x
and y axes and colored rings?

-Allison
Re: 2D Plot in IDL with shading? [message #71449 is a reply to message #71448] Fri, 18 June 2010 12:49 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ally writes:

> I have three arrays-sun elevation, azimuth, and diode response, for
> each of 12 sun sensors and I'm trying to create a 2D plot in IDL with
> elevation on the x-axis, azimuth on the y-axis and the diode response
> color coded on a gradient scale. It would kind of be like a birds-eye
> view of what a 3D graph with elevation shading would look like. I've
> been searching for two days now and can't seem to find anything online
> that shows me how to make a graph like this. Any help is appreciated.

Are you looking for something like this:

http://www.dfanning.com/graphics_tips/coloredline.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: 2D Plot in IDL with shading? [message #71516 is a reply to message #71419] Mon, 21 June 2010 12:15 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jun 21, 3:41 pm, Ally <ally.desh...@gmail.com> wrote:
> On Jun 21, 11:14 am, pp <pp.pente...@gmail.com> wrote:
>
>> On Jun 21, 12:09 pm, Ally <ally.desh...@gmail.com> wrote:
>
>>> Great, that's exactly what I needed! I'm working on creating it right
>>> now.  Out of curiosity, is there any way to make a graph like that in
>>> 2D to start with, without a z-axis and just response plotted in color
>>> vs azimuth and elevation?
>
>> That is what would be called an image, which can be made with
>
>> iimage,response,elevation,azimuth
>
> I keep trying but can't seem to get isurface to graph it.  I may be
> missing something basic but I've been reading through different
> examples and can't figure it out.  Here is what I have:
>
> rows = 5273670
> OPENR, lun1, 'ss_raw_06.dat', /GET_LUN
> data = DBLARR(2,rows)
> READF, lun1, data
> response= data(1,*)
>
> OPENR, lun2, 'az.dat', /GET_LUN
> data2=DBLARR(2, rows)
> READF, lun2, data2
> az_g= data2(1,*)
>
> OPENR, lun3, 'sun_el_and_az.dat', /GET_LUN
> data3=DBLARR(2,rows)
> READF, lun3, data3
> az_s=data3(1,*)
> elevation=data3(0,*)
>
> azimuth=(az_s)-(az_g)
>
> isurface, response, elevation, azimuth
>
> It runs fine and the iSurface tool opens, there's just nothing
> graphed.

Have you checked that the data look right? You can check the
dimensions with

help,response,elevation,azimuth

And maybe min()/max() may be useful to tell if the values seem to make
sense.

You are reading all 3 arrays as 1D. You indicated above that you have
one response for each elevation and azimuth, which indicates that
response should be reformed to 2D, with the proper dimensions:

response_2D=reform(response,nx,ny)

Where nx is the length of the fastest-varying dimension (leftmost),
and ny is the other dimension. For this to be consistent with the way
you called isurface, the fastest-varying dimension in the file where
you read response from would have to be elevation, and the other would
be the azimuth.

If you do not provide response as a 2D array, the itools will not know
the connectivity of your points, and thus will start the gridding
wizard, to interpolate them, guessing they were not on a regular grid,
which is not your case.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Error detected while calling MPFIT_FDJAC2
Next Topic: Selecting data from two separate arrays

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

Current Time: Thu Oct 09 06:03:45 PDT 2025

Total time taken to generate the page: 0.96094 seconds