Re: Q: Varying colors in Plot3D according to Height

*To*: mathgroup at smc.vnet.net*Subject*: [mg55436] Re: Q: Varying colors in Plot3D according to Height*From*: Jeff Bryant <jeffb at wolfram.com>*Date*: Wed, 23 Mar 2005 05:34:46 -0500 (EST)*References*: <200503220851.DAA23758@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

There are a number of ways you can do this. Using Plot3D, you can use the following: Plot3D[{4 Sin[x] + 4 Cos[y], If[4 Sin[x] + 4 Cos[y] > 1, Red, RGBColor[1, 1, 1]]}, {x, 0, 4 Pi}, {y, 0, 4 Pi}, BoxRatios -> {1, 1, 1/GoldenRatio}, PlotPoints -> 50] You can get better effects, including easier lighting effects, using ParametricPlot3D: ParametricPlot3D[{x, y, 4 Sin[x] + 4 Cos[y], {EdgeForm[], SurfaceColor[If[4 Sin[x] + 4 Cos[y] > 1, Red, RGBColor[1, 1, 1]]]}}, {x, 0, 4 Pi}, {y, 0, 4 Pi}, BoxRatios -> {1, 1, 1/GoldenRatio}, PlotPoints -> 50] -Jeff -------------- Jeff Bryant Wolfram Research, Inc. Mark Coleman 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

**References**:**Q: Varying colors in Plot3D according to Height***From:*Mark Coleman <mark@markscoleman.com>