Re: ListContourPlot with (x,y,z) values
- To: mathgroup@smc.vnet.net
- Subject: [mg12622] Re: ListContourPlot with (x,y,z) values
- From: "Allan Hayes" <hay@haystack.demon.cc.uk>
- Date: Tue, 26 May 1998 02:38:21 -0400
- References: <6kajtj$2cb@smc.vnet.net>
Joel Cannon wrote in message <6kajtj$2cb@smc.vnet.net>...
>Can anyone point me to a source for a package or show me how to modify
>ListContourPlot so that I can use (x,y,z) values. The standard package
>takes an array of z values leaving me or someone else to translate the
>matrix indices into x and y coordinates.
Joel,
You will need to extract the z coordinates for ContourListPlot and
extract the min and max of the x and y coordinates to put into the
option MeshRange -> {{xmin,xmax},{ymin,ymax}}
Example
xyztable=Table[{x,y, y}, {x,.5,4,.5},{y,0.0,3,.5}];
ztable= Map[#[[3]]&, xyztable,{2}];
xtable= Map[#[[1]]&, xyztable,{2}];
ytable= Map[#[[2]]&, xyztable,{2}];
xrange = Through[{Min,Max}[xtable]]; yrange =
Through[{Min,Max}[ytable]];
ListContourPlot[ztable, MeshRange -> {xrange, yrange},
FrameLabel -> {"y", "x"}];
Note that the axes are not as might be expected from ContourPlot[y,
{x,.5,4},{y,0.0,3}];
We can transpose ztable and interchange the labels to get this form.
------------------------------------------------------------- Allan
Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay@haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642