Re: 3D plots from lists

• To: mathgroup at smc.vnet.net
• Subject: [mg48744] Re: [mg48706] 3D plots from lists
• From: Christopher Purcell <christopherpurcell at mac.com>
• Date: Fri, 11 Jun 2004 23:59:28 -0400 (EDT)
• References: <200406110752.DAA24891@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Here is a simple example where a text file of triplets of numbers are
created. These are read back in, an Interpolation of them is created,
and then we can plot the Interpolation function as a surface. Is this

testdata = Flatten[Table[{x, y, Sin[x y]}, {x, 0, 6, .3}, {y, 0, 6,
.3}], 1];
Export[ "junk.txt", testdata, "Table"];
data = ReadList[stream, {Number, Number, Number}];
Clear[f];
f = Interpolation[data];
ParametricPlot3D[{x, y, f[x, y]}, {x, Min[data[[All, 1]]],
Max[data[[All,
1]]]}, {y, Min[data[[All, 2]]], Max[data[[All, 2]]]}]

P.S. If your Fortran created data set uses E format, you may need to do
a fancier read of the data, using StringToStream and Read, rather than

christopherpurcell at mac.com

On Jun 11, 2004, at 4:52 AM, Giorgio Torrieri wrote:

> This might be naive, but I worked on this problem for days, and the
> users manual seems to be of no help.
>
> I have a 3 column output generated by a FORTRAN program, in the
> following form:
>
> X    Y    F(X,Y)
>
> Is there any way to make Mathematica understand this format and plot
> it with something like ListPlot3D?    It seems to require all 3D plots
> to be square arrays of the form F(X,Y) only, and I would much rather
> not modify the fortran program output.
>