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

Home » Public Forums » archive » Re: XYZ plotting
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: XYZ plotting [message #44711] Tue, 12 July 2005 06:58
burkina is currently offline  burkina
Messages: 32
Registered: February 2005
Member
Thank you, I've written a small routine that creates the 2D array and
it seems to work.

Ciao,

Stefano
Re: XYZ plotting [message #44716 is a reply to message #44711] Mon, 11 July 2005 23:50 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
burkina wrote:
> Well, this is probably a silly question, but I cannot find a
> straightforward answer, so I think I'd better ask to someone who
> understanfs IDL much better than me!
>
> I have an ASCII file with a 3D function, like:
>
> 0.55 2.0 0.000198665
> 0.55 2.25 0.000215043
> 0.55 2.5 0.000228681
> 0.55 2.75 0.000241278
> 0.55 3.0 0.000253149
> 0.55 3.25 0.000266940
> 0.55 3.5 0.000287297
> 0.55 3.75 0.000321452
> 0.55 4.0 0.000387827
> 0.55 4.25 0.000547268
> 0.55 4.5 0.00110803
> 0.55 4.75 0.00685613
> 0.55 5.0 64.4346
> 0.55 5.25 1013.68
> 0.6 2.0 0.000353857
> 0.6 2.25 0.000383346
> 0.6 2.5 0.000407687
> .......
>
> Quite obviously, the first is the X value, the second is the Y value
> and the third is the Z value.
>
> I simply would like it to treat it with the contour and the surface
> commands.
> I've found a method in Dave Fanning's page, but I would prefer not to
> use triangular grids. Instead I'd prefer to change the dataset in the
> 2-d array required by contour and 2 linear vectors for x and y.
> I guess I wuold succed in doing this with some loops, but I hoped there
> would be an easier way with IDL. I mean... is there a straightforward
> way to plot your xyz data in IDL?
>
> Alternatively (but I guess it's almost the same idea), I would like to
> plot in the x-y plane the z values with a color code, like an image,
> selecting the ranges for each color as I prefer, likely smoothing the
> image.
>
> Thanks for your help,
>
> Stefano
>

Dear Stefano,

you could have a look at the plot examples of our library. Probably
there is one which fits your needs.

http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html

or the examples only

http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/idl_work_idl_work.examples.category.htm

cheers

Reimar


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
Re: XYZ plotting [message #44723 is a reply to message #44716] Mon, 11 July 2005 10:46 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Alternatively (but I guess it's almost the same idea), I would like to
> plot in the x-y plane the z values with a color code, like an image,
> selecting the ranges for each color as I prefer, likely smoothing the
> image.

First, I want to apologize for such a general answer, but I don't have
the time at the moment to write something more complex. Maybe someone
else can fill in the details.

What you need to do is create a 2 dimensional array. The X index of the
array corresponds to your x value and the Y index of the array
corresponds to your Y value. Because your X and Y data includes
decimals, you'll need to create a mapping for each. Something like X
value of 0 maps to index 0, X value of 0.5 maps to index 1, value of 1
maps to index 2, etc, etc. You'll need to do the same for Y.

Inside the two dimensional array, you'll want to store the Z values.
Once all the values are in your array, you'll need to make the values
suitable for coloring. You'll use the bytscl() command on your array.
This will map all of your values into the range 0 to 255. The lowest
value will map to 0 and the highest will map to 255. You need to do
this so there is a direct mapping from value to color (and there's at
most 256 colors in a color table). You'll now want to load an
appropriate color table with the loadCT command. You can plot the array
using the TV command or even better, David Fanning's TVImage.

Again, sorry for the lack of actual IDL code, but maybe someone will be
nice enough to fill in what I don't have time to write.

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Giving Up on Windows
Next Topic: erratic EOF encountered when reading in similar data

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

Current Time: Wed Oct 08 19:19:28 PDT 2025

Total time taken to generate the page: 0.00593 seconds