This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Graphics and Sound / Advanced Options  /

  • ColorFunction is an option for various graphics functions which specifies a function to apply to values to determine the color to use for a particular , region.
  • ColorFunction is an option for Plot3D, ListPlot3D, DensityPlot, ContourPlot, Raster and related functions.
  • The arguments provided for the function specified by ColorFunction are always in the range 0 to 1.
  • For three-dimensional, density and contour plots, the arguments correspond to scaled values.
  • The function specified by ColorFunction must return a CMYKColor, GrayLevel, Hue or RGBColor directive.
  • ColorFunction -> Automatic yields a range of gray levels.
  • ColorFunction -> Hue yields a range of colors.
  • In three-dimensional graphics, ColorFunction is used only with the option setting Lighting -> False.
  • See the Mathematica book: Section 1.9.6, Section 1.9.6, Section 1.9.7Section 2.9.2.
  • See also: Lighting, ColorOutput.

    Further Examples

    Here is a density plot colored according to the Hue directive.

    Evaluate the cell to see the graphic.