Re: [Q] CountorPlot as part of 3D Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg4398] Re: [Q] CountorPlot as part of 3D Plot
- From: Xah Lee <xah at best.com>
- Date: Mon, 15 Jul 1996 11:13:37 -0400
- Organization: Best Internet Communications
- Sender: owner-wri-mathgroup at wolfram.com
Gerd Lanfermann wrote:
> problem: i want to display a 3d plot, of lets say saddle, using Plot3D.
> I also want to to include a colored contour plot of this saddle ON THE
> BOTTOM of the 3D-box, that matches the 3d plot.
The plan is to convert your ContourGraphics to a 3D graphics primitive, then you can display
it with the surface of your function.
The data of ContourGraphics, DensityGraphics, and SurfaceGraphics are just a rectangular
array. The difference is how they are rendered in Show. To display a ContourGraphics as a
surface, just add the head SurfaceGraphics to your data and use Show. But what you want is to
convert the contour data array into graphic primitives as a list of Lines and Polygons that
represents the contour. This you do by adding the head Graphics to it. Once your contour data
array became a list of 2D graphic primitives, you add a dimension to all the point in them so
they became a list of 3D primitives. Finally display this together with your SurfaceGraphics
of the function.
In[8]:=
myFunction[a_,b_][x_,y_]:=((x-a)^2 + y^2) ((x+a)^2 + y^2) - b^4
In[9]:=
myContourData = ContourPlot[ myFunction[1,1][x,y],
{x,-2,2}, {y,-1.2,1.2},
Contours->Table[ i^2-1,{i,-1, 2.5, 1/4}],
PlotPoints->25,
AspectRatio->Automatic,
PlotRange->All,
ContourLines->True, ContourShading->True,
ContourStyle->({Hue[#,1,.5],Thickness[.006]}&/@Range[0,1,1/12]),
ColorFunction->Hue,
Ticks->{Range[-1,1], Range[-2,2],{-.5,.5}}
];0;
In[10]:=
myContourGP = First@ Graphics@ myContourData;
myContourGP = N@ myContourGP /. {x_?AtomQ, y_?AtomQ}->{x,y,-20};
In[12]:=
Show[
{ SurfaceGraphics@ myContourData,
Graphics3D@ myContourGP
},
Axes->True,
BoxRatios->{1,1,1}
];0;
Hope this helps.
If you are using a Mac, you might want to get Rotater--An excellent freeware for visualing
wireframes in realtime, together with a mathematica to Rotater converter package. You can get
them at
http://www.best.com/~xah/PageTwo_dir/MathPrograms_dir/mathPrograms.html
Xah
xah at best.com; 74631.731 at compuserve.com
http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
Mountain View, CA, USA
==== [MESSAGE SEPARATOR] ====