Re: XYZ plotting [message #44723 is a reply to message #44716] |
Mon, 11 July 2005 10:46  |
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
|
|
|