I'm trying to make an image or contour plot with X, Y, and Z data as matrices (34x52), but can't seem to find any function that will take X and Y as matrices. Any hints?
Why are your X (for example) values in a two-dimensional matrix?
That seems pretty odd.
Perhaps you can create three one-dimensional arrays (waves), one for X, one for Y, and one for Z.
Or maybe your X and Y values form a regularly-spaced grid, and you can put your Z values into a 34 x 52 matrix and use X and Y scaling to assign x and y values to that one matrix.
If your X and Y values are not equally spaced (logarithmic isn't equally spaced, for example), either use the three one-d waves, or use a 34 point X wave and 52 point Y wave to provide regular non-equally spaced grid locations (If I've guessed properly that 34 is the X dimension of your data) for a contour plot. For an image, you'd need a 35 point X wave and a 53 point Y wave.
Why are your X (for example) values in a two-dimensional matrix?
That seems pretty odd.
Perhaps you can create three one-dimensional arrays (waves), one for X, one for Y, and one for Z.
Or maybe your X and Y values form a regularly-spaced grid, and you can put your Z values into a 34 x 52 matrix and use X and Y scaling to assign x and y values to that one matrix.
If your X and Y values are not equally spaced (logarithmic isn't equally spaced, for example), either use the three one-d waves, or use a 34 point X wave and 52 point Y wave to provide regular non-equally spaced grid locations (If I've guessed properly that 34 is the X dimension of your data) for a contour plot. For an image, you'd need a 35 point X wave and a 53 point Y wave.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
The data is output from a weather model. The X is longitude, but the grid is slanted compared to how you're used to looking at it on a map. Thus, each data point needs the longitude, latitude, and Z variable uniquely declared. There are 34x52=1768 unique pairs of lat-long, so condensing these variables to 1D will not work for the Z matrix as it currently is.
I have reshaped the matrices to 1D, but then can't do an image plot can I? The only thing I've figured out how to do is plot lat vs long then color square markers by Z, but this, of course, doesn't look as good as an image plot would.
I guess there are no plotting functions that accept X, Y, and Z as matrices?
That seems pretty odd.
Perhaps you can create three one-dimensional arrays (waves), one for X, one for Y, and one for Z.
Or maybe your X and Y values form a regularly-spaced grid, and you can put your Z values into a 34 x 52 matrix and use X and Y scaling to assign x and y values to that one matrix.
If your X and Y values are not equally spaced (logarithmic isn't equally spaced, for example), either use the three one-d waves, or use a 34 point X wave and 52 point Y wave to provide regular non-equally spaced grid locations (If I've guessed properly that 34 is the X dimension of your data) for a contour plot. For an image, you'd need a 35 point X wave and a 53 point Y wave.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
January 23, 2012 at 05:02 pm - Permalink
The data is output from a weather model. The X is longitude, but the grid is slanted compared to how you're used to looking at it on a map. Thus, each data point needs the longitude, latitude, and Z variable uniquely declared. There are 34x52=1768 unique pairs of lat-long, so condensing these variables to 1D will not work for the Z matrix as it currently is.
I have reshaped the matrices to 1D, but then can't do an image plot can I? The only thing I've figured out how to do is plot lat vs long then color square markers by Z, but this, of course, doesn't look as good as an image plot would.
I guess there are no plotting functions that accept X, Y, and Z as matrices?
January 23, 2012 at 05:18 pm - Permalink
Your best bet is to simply redimension your matrices as in:
Redimension/N=(34*52) xMatrix,yMatrix,zMatrix
Next convert these into a triplet:
Concatenate {xMatrix,yMatrix,zMatrix}, tripletWave
Now run ImageInterpolate to create a standard image sampled on a regular rectangular grid:
ImageInterpolate/S={xmin,dx,xmax,ymin,dy,ymax} voronoi tripletWave
The resulting M_InterpolatedImage is the image you want to display/contour.
I hope this helps,
A.G.
WaveMetrics, Inc.
January 24, 2012 at 09:30 am - Permalink
January 24, 2012 at 11:35 pm - Permalink