MathGroup Archive 2005

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

Search the Archive

Re: Q: Varying colors in Plot3D according to Height

  • To: mathgroup at
  • Subject: [mg55437] Re: Q: Varying colors in Plot3D according to Height
  • From: yehuda ben-shimol <bsyehuda at>
  • Date: Wed, 23 Mar 2005 05:34:47 -0500 (EST)
  • References: <>
  • Reply-to: yehuda ben-shimol <bsyehuda at>
  • Sender: owner-wri-mathgroup at

Say that your function is called f of two parameters say, x and y. for
the following example I will use f[x_,y_]:=2*Sin[x+y]
You need to set the option ColorFunctionScaling->False and define your
own ColorFunction

look at the following example


Notice that the areas with values below 1 will NOT be colored with the
default colors, since you need to operate the ColorFunction on the
unscaled values of your function. However the red areas are exactly
what you needed.

Since the Hue[] function is cyclic (i.e., Hue[x]==Hue[Mod[x,1]])
scaling is important for nice representation. In case you KNOW in
advanced the maximal value of the function (call is maxF) then you may
modify the code a little by


But from some tests I made I do not really think this is important

On Tue, 22 Mar 2005 03:51:04 -0500 (EST), Mark Coleman
<mark at> wrote:
> I am plotting a three-dimension function using Plot3D. I would like to
> highlight the portion of the surface whose height exceeds 1.0 a
> different color or hue than the portion of the surface below 1.0. My
> attempts at using ColorFunction to do this have been less than
> aesthetically pleasing, to say the least. Ideally, I'd like the portion
> below 1.0 to retain the default Mathematica blue shading (I'm using
> Mathematica ver 5.1.1 on a Mac OS X 10.3.8), and perhaps have the portion
> above 1.0 to have a red shading. Any help would be greatly appreciated.
> Thanks,
> -Mark

  • Prev by Date: Re: Correct errors on fit parameter ?
  • Next by Date: Re: Problems with NDSolve and Splines
  • Previous by thread: Re: Q: Varying colors in Plot3D according to Height
  • Next by thread: File names shortened in 5.1 under Windows 2000