MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ListPlot vs ListPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28906] Re: ListPlot vs ListPlot3D
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 18 May 2001 01:13:09 -0400 (EDT)
  • References: <9e02ft$2vu@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Otto,

The options MeshRange works if the array is evenly spaced.

data= Table[{x,y,x^2+y^2},{x,-4,4},{y,-5,7}];

Extract array of z values

dataz =data/.{__,z_?NumberQ}->z

Get the x and y ranges

mr={Min[#],Max[#]}&/@{data[[All,All,1]],data[[All,All,2]]};

Use ListPlot3D with MeshRange ->mr;

ListPlot3D[dataz, MeshRange->mr];



If we have an uneven rectangular grid we can make an interpolation function
for data and plot that: for example

fn=Interpolation[Flatten[data,1],InterpolationOrder\[Rule]1]

        InterpolatingFunction[{{-4,4},{-5,7}},<>]

Plot3D[fn[x,y],{x,-4,4},{y,-5,7}]

If the points are not on a rectangular grid then the function
        TriangularSurfacePlot
from the standard add-on
        <<DiscreteMath`ComputationalGeometry`
can be used.

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Otto Linsuain" <linsuain+ at andrew.cmu.edu> wrote in message
news:9e02ft$2vu at smc.vnet.net...
>
> Dear Mathematica experts, I was wondering if there is a way of plotting
> a 3D graph using a rectangular array of z-values USING THE CORRESPONDING
> VALUES OF X AND Y.
>
> Here is what I mean:
>
> with a 2D plot, one can do:
>
> ListPlot[ {y1,y2,y3,.........yn} ]  and this will give a graph of the
points
>
> {y1,1} ,{y2,2}, {y3,3},....{yn,n}, i.e. it will use the integers
> 1,2,3,...n as the x values.
>
> One can, however, write
>
> ListPlot[ { {x1,y1}, {x2,y2}, {x3,y3}, ... {xn,yn} }]
>
> and get a graph with user-specified values for x and y.
>
> There doesn't seem to be an analogous thing for ListPlot3D. The values
> of x and y seem to be always {1,1}, {1,2},{2,1},{2,2},.......{n,n}
>
> Any ideas? Thanks in advance. Otto Linsuain.
>




  • Prev by Date: Re: Q: Recursion on a list
  • Next by Date: RE: array generated
  • Previous by thread: Re: ListPlot vs ListPlot3D
  • Next by thread: Re: ListPlot vs ListPlot3D