Re: contour plot from a list
- To: mathgroup at smc.vnet.net
- Subject: [mg37935] Re: contour plot from a list
- From: Tom Burton <tburton at brahea.com>
- Date: Wed, 20 Nov 2002 09:09:06 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
On 11/19/02 6:06 PM, in article areqmq$190$1 at smc.vnet.net, "Nadia
Elghobashi" <nadiae at chemie.fu-berlin.de> wrote:
> I have data of the form {x,y,z} which I would like to plot as a contour
> plot. I have read in the data as:
>
> t=ReadList["file",Number,RecordLists->True];
>
> and would now like to make a simple contour plot of the z values on my
> regularly spaced grid.
It says in the on-line help that ListContourPlot accepts an array of z
values only. So you need to specify the ranges of x and y separately as the
MeshRange option. Given, for example, the following result of ReadList,
t = Flatten[
Table[{x, y, x x + y y}, {x, 2, 40, 2}, {y, 3, 30, 3}],
1]
here is one way to do this:
ts = Split[t,First[#1]==First[#2]&]
mr = {
{ts[[1,1,1]], ts[[-1,1,1]]},
{ts[[1,1,2]], ts[[1,-1,2]]}
}
ta=ts[[All,All,3]]
ListContourPlot[ta, MeshRange -> mr]