[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plot (x,y,z) triplets as a surface?



In article <941660333.808073@clam-55>,
  "Mark Hadfield" <m.hadfield@niwa.cri.nz> wrote:
> As I understand it you want to read in a series of (x,y,z) triplets
> which actually represent vertices in a m x n rectangular array, i.e.
> something like this (for m=2, n=3) [SNIP]
> and you want to reorganise the data into an X vector (dimensioned
> [m]), a Y  vector (dimensioned [n]) and a Z array (dimensioned [m,n])
> and generate a surface plot. Can you confirm that this is the problem
> you are trying to solve, and indicate which part you are having
> difficulty with.

That's exactly it.  I have not had a chance to mess around with
Craig's suggestion (thanks Craig) of REFORM, but if I had known about
that function I would have tried that before posting.

> Do you know m and n in advance?

Yes.

> Can you control the order in which the data are written into
> the file?

I can control everything ;-).  It's a Pascal program written by me,
so I can have it write the data any-which-way.

Allow me to give some more information, and you'll see why this has
been such a vexing problem for me.  There is also an adjunct problem
that I hope people will have some ideas for.

Before starting to use IDL, I used a plotting program that *ONLY*
could plot surfaces in the way I indicated: an array of Z-values
with X,Y determined by column and row.  The REFORMation suggested
by Craig does not have an analogue in my old program.  It could make
a 3D scatterplot from (X,Y,Z) triplets, but to grid a surface it
needed the data in an array.  The problem of unevenly-spaced data,
discussed by David, is likewise impossible in the package I used
before.

MAIN PROBLEM: Now, the data I have are evenly spaced in X (age) and Y
(time), but there was always a problem with axis labeling.  The axis
labels always popped up 1..50, 1..100 if the array was 50x100, for
example.  Never mind that the units were in months, so 12=1year, but I
needed labels in years etc.  In X-Y-Z, I have control over units!  I
used to always have to go in and change the axis labels by hand when I
was on my "final" version, but inevitably, I would want to change
something again, and it became a nightmare to keep the axis labels
accurate.  Part of the reason I want triplets is to keep track of my
age/time variables in their real units, not in arbitrary units.  It
seems that IDL can work this much better: from the manual for SURFACE:
"X -- A vector or two-dimensional array specifying the X coordinates
of the grid. If this argument is a vector, each element of X specifies
the X coordinate for a column of Z (e.g., X[0] specifies the X
coordinate for Z[0,*] )."  So I specify my X,Y vectors and I'm home
free?  This used to cause me no end of aggravation.

ADJUNCT PROBLEM: My old package could switch between RH and LH
coordinate systems with the touch of a button.  I was just looking at
some of the graphs, and I wrote down an example.  In RH, we have (in
this case) X on the horizontal axis and Y on the vertical axis and Z
the depth axis.  Z starts at 0 (away from the viewer) and goes to 80
(closer to the viewer).  X is 0 at left, 100 at right, and Y is 0 at
bottom and 150 at top.  In LH, Z and Y are unchanged, but X goes from
100 at left to 0 at right.

I asked someone at RSI about changing between RH/LH coordinate
systems, and got a response that IDL doesn't have a setting to do
this.  But upon considering the above, it seems to me that IDL could
do this, no?  In a 2D PLOT, it is trivial in IDL to reverse one axis
but leave the other.  I'm less sure about SURFACE.

No amount of rotation, changing aspect, etc., can switch between
RH/LH, but there must be some clever way to REFORM the data to get RH
or LH system?  The trick is to be very sure the axis labels are
correct at the end of it all.

Thanks to those who responded.  Any ideas about the RH/LH systems?
Sometimes I mess with surfaces from a million angles, only to find that
the ONLY way to make them "look right" is to switch to a LH coordinate
system.  It's simple yet very powerful.

Thanks in advance if you have any more thoughts.

-- Andrew

noymer@my-deja.com



Sent via Deja.com http://www.deja.com/
Before you buy.