MathGroup Archive 2001

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

Search the Archive

Re: ListPlot vs ListPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28891] Re: ListPlot vs ListPlot3D
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 18 May 2001 01:12:58 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <9e02ft$2vu@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

MathGL3d's MeshGraphics3D[] object does this, it preserves the
rectangular structure of the parameter domain and store
3d points. These 3d points are connected to Mathematica's
Polygons when the MeshGraphics3D[] object is used in
Mathematica.

For you data you may construct the MeshGraphics3D[] object by
hand with

MeshGraphics3D[n,m,data,{},AbsoluteOptions[ParametricPlot3D]];

or you may simply use the polygon creation function used by the
conversion
to a Graphics3D[] object

makeMesh[vl_List,col_List]:=
   Module[{l = vl, l1 = Map[RotateLeft, vl], mesh},
     mesh = {l, l1, RotateLeft[l1], RotateLeft[l]}
     mesh = Map[Drop[#, -1]&, mesh, {1}];
     mesh = Map[Drop[#, -1]&, mesh, {2}];
     mesh=Map[
           Polygon[Reverse[#]] &,
             Transpose[
               Flatten[#,1] & /@
                mesh
              ]
          ] //Flatten;
     If[col==={}, Return[mesh]];
     If[(Drop[Dimensions[vl],-1]-{1,1})==Take[Dimensions[col],2],
       Transpose[{Flatten[col,1],mesh}]/. {l_List,p_Polygon}:>
Append[l,p]
      ]
    ]

Calling the function above with

makeMesh[yourArrayOf3dPoints,{}]

will return a Array of polygons
that can be used in 

Show[Graphics3D[makeMesh[yourArrayOf3dPoints,{}]]]

Regards
  Jens

Otto Linsuain wrote:
> 
> 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: Has anybody gotten MathLink Modules to compile using Linux Mandrake 8.0
  • Next by Date: Re: Creating graph with only a few data points
  • Previous by thread: Re: ListPlot vs ListPlot3D
  • Next by thread: RE: ListPlot vs ListPlot3D