MathGroup Archive 2009

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

Search the Archive

Re: ColorFunction and question about how to use it

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101671] Re: [mg101635] ColorFunction and question about how to use it
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 14 Jul 2009 05:33:51 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

There are two arguments to Function; not a rule. Use

Plot3D[x + y, {x, -2, 2}, {y, -2, 1}, 
 ColorFunction -> Function[{x, y, z}, Hue[z]]]

I believe that the default coloring is due to the Lighting.

Plot3D[x + y, {x, -2, 2}, {y, -2, 1}, Lighting -> "Neutral"]


Bob Hanlon

---- David <david.b.a.epstein at googlemail.com> wrote: 

=============
Here is some Mathematica code

In[1]:= Options[Plot3D]

Out[1]= {AlignmentPoint -> Center, AspectRatio -> Automatic,
 Axes -> True, AxesEdge -> Automatic, AxesLabel -> None,
 AxesOrigin -> Automatic, AxesStyle -> {}, Background -> None,
 BaselinePosition -> Automatic, BaseStyle -> {},
 BoundaryStyle -> GrayLevel[0], Boxed -> True,
 BoxRatios -> {1, 1, 0.4}, BoxStyle -> {}, ClippingStyle -> Automatic,
  ColorFunction -> Automatic, ColorFunctionScaling -> True,
 ColorOutput -> Automatic, ContentSelectable -> Automatic,
 ControllerLinking -> Automatic, ControllerMethod -> Automatic,
 ControllerPath -> Automatic, CoordinatesToolOptions -> Automatic,
 DisplayFunction :> $DisplayFunction, Epilog -> {},
 Evaluated -> Automatic, EvaluationMonitor -> None,
 Exclusions -> Automatic, ExclusionsStyle -> None, FaceGrids -> None,
 FaceGridsStyle -> {}, Filling -> None, FillingStyle -> Opacity[0.5],
 FormatType :> TraditionalForm, ImageMargins -> 0.,
 ImagePadding -> All, ImageSize -> Automatic, LabelStyle -> {},
 Lighting -> Automatic, MaxRecursion -> Automatic, Mesh -> Automatic,
 MeshFunctions -> {#1 &, #2 &}, MeshShading -> None,
 MeshStyle -> Automatic, Method -> Automatic,
 NormalsFunction -> Automatic, PerformanceGoal :> $PerformanceGoal,
 PlotLabel -> None, PlotPoints -> Automatic,
 PlotRange -> {Full, Full, Automatic}, PlotRangePadding -> Automatic,
 PlotRegion -> Automatic, PlotStyle -> Automatic,
 PreserveImageOptions -> Automatic, Prolog -> {},
 RegionFunction -> (True &), RotationAction -> "Fit",
 SphericalRegion -> False, Ticks -> Automatic, TicksStyle -> {},
 ViewAngle -> Automatic, ViewCenter -> Automatic,
 ViewMatrix -> Automatic, ViewPoint -> {1.3, -2.4, 2.},
 ViewRange -> All, ViewVector -> Automatic, ViewVertical -> {0, 0, 1},
  WorkingPrecision -> MachinePrecision}


In[2]:=
Plot3D[x + y, {x, -2, 2}, {y, -2, 1},
 ColorFunction -> Function[{x, y, z} -> Hue[z]]]

Plot3D[x + y, {x, -2, 2}, {y, -2, 1}]
-----------------------------------------------------------------------------
The first Plot3D command gives me only black and white. Why is that?
Otherwise it looks fine.
The second Plot3D command gives me the graph in a uniform blue. Why is
that? Apart from the colour, the two graphs look the same.

What I am actually trying to do is more complicated, but I need to
understand the simplest situations first: I have a given real valued
function f of two variables. I can show that there are exactly two
{x,y} locations at which the two partial derivatives of f are
simultaneously zero. I would like to demonstrate this through Plot3D,
for example by plotting the sum of the squares of the two partial
derivatives. The function surface should be mostly transparent, but
the surface would be coloured (say red) whenever the sum of squares
lies in the closed interval [0,epsilon], with the value of the
positive number epsilon under user control. Transparency would enable
one to see the zeros even if the surface is in the way.

My many attempts to achieve this have all failed.

Thanks for any help.

David





  • Prev by Date: Re: Plot Label at bottom with quote marks
  • Next by Date: Re: Jens-Peer Kuska passed away
  • Previous by thread: Re: ColorFunction and question about how to use it
  • Next by thread: Re: ColorFunction and question about how to use it