ColorFunction

Most graphics functions in Mathematica have a ColorFunction option.  The value of a function is used to specify the color or shade of gray used to make each portion of the graphic.  Some examples of ColorFunction are shown below. The "#&" notation is explained in my discussion of Slot, SlotSequence.

RowBox[{RowBox[{Plot3D, [, RowBox[{Sin[x + y], ,, {x, -π, π}, ,, {y, -π, π ... wBox[{GrayLevel, [, 0.5, ]}], ,, RowBox[{GrayLevel, [, 0.8, ]}]}], ]}], &}], )}]}]}], ]}], ;}]

RowBox[{RowBox[{Plot3D, [, RowBox[{Sin[x + y], ,, {x, -π, π}, ,, {y, -π, π ... ox[{0.8, #}]}]}], ]}], &}], )}]}], ,,   , Mesh->False, ,, PlotPoints->30}], ]}], ;}]

You will find we can't have a ColorFunction that is sometimes a color and sometimes a GrayLevel.  However, we can still get the same result by using RGBColor[a,a,a]  in place of GrayLevel[a] as in the next cell.    

RowBox[{RowBox[{Plot3D, [, RowBox[{Sin[x + y], ,, {x, -π, π}, ,, {y, -π, π ... ]}], ,, RowBox[{RGBColor, [, RowBox[{0.8, ,, 0.8, ,, 0.8}], ]}]}], ]}], &}], )}]}]}], ]}], ;}]


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page