Re: Plot3D with only x or y mesh?
- To: mathgroup at smc.vnet.net
- Subject: [mg9636] Re: Plot3D with only x or y mesh?
- From: "Xah" <xah at best.com>
- Date: Mon, 17 Nov 1997 19:49:44 -0500
- Organization: smtp.best.com
- Sender: owner-wri-mathgroup at wolfram.com
In article <64e898$qgn at smc.vnet.net>, siegman at ee.stanford.edu (AES) wrote: >Can one make Plot3D plots with only x mesh lines, or only y mesh lines? Not with build-in functions or options, but you can do it easily otherwise. Here's a solution. data=N at Table[{x,y,Sin[x*y]},{x,0,Pi,Pi/10},{y,0,Pi,Pi/10}]; xGrid=Line/@data; yGrid=Line/@(Transpose at data); Show[Graphics3D[{{Hue[0],xGrid},{Hue[.7],yGrid}}],AspectRatio->Automatic, Axes->True,BoxRatios->{1,1,1/Pi}]; You can get more elaborate by adding the surface surface=First@ Graphics3D@ Plot3D[Sin[x*y],{x,0,Pi},{y,0,Pi},PlotPoints->{11,11}, DisplayFunction->Identity]; Show[Graphics3D[{ AbsoluteThickness[1],{Hue[0],xGrid},{Hue[.7],yGrid},{EdgeForm[], surface/.Polygon[pts_]:> Polygon at Module[{centroid=Plus@@pts/Length at pts}, Map[((#-centroid)*.5+centroid)&,pts]]}}], AspectRatio->Automatic,Axes->True,BoxRatios->{1,1,1/Pi}]; Here's a quick explaination on the surface bit. First you use Plot3D to get the data. Because Plot3D uses a matrix to represent the surface, you need to convert it to Polygon, and this is done by adding the head Graphics3D. The command *First* is used to extract the first part of the graphics object, because the second part is a list of options such as Axes->True, which we don't need here. Now we display the xGrid, yGrid, and surface together in Show. For the surface, we shrink each Polygon a bit so it falls inside the grid nicely. This is done by calculating vectors of the centroid to the vertxes of each polygon, scale it to half, and form the vertexes again. Xah, xah at best.com http://www.best.com/~xah/SpecialPlaneCurves_dir/MathematicaPackages_dir/MathematicaPackages .html Mountain View, CA, USA