ColorFunctionScaling

ColorFunctionScaling is an option for SurfaceGraphics, DensityGraphics, ContourGraphics, Raster and functions that return these graphic objects.  The default setting is (ColorFunctionScaling→True) in which case function values are scaled such that the minimum value is mapped to 0 and the maximum value is mapped to 1.  These mapped values are then used to determine a color for each point on the plot.  The color is determined from the setting of the ColorFunction option. When the setting (ColorFunctionScaling→False) is used the function values are sent directly to the function determined by the ColorFunction setting. Notice when the setting (ColorFunction→Automatic) is used a negative value has the same effect as 0 and a value greater than 1 has the same effect as 1.
The cells that follow demonstrate how ColorFunctionScaling affects DensityGraphics and ContourGraphics.

DensityPlot[Cos[x y]/10 + 1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScalingTrue] ; DensityPlot[Cos[x y]/10 + 1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScaling->False] ;

ContourPlot[Cos[x y]/10 + 1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScalingTrue] ; ContourPlot[Cos[x y]/10 + 1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScaling->False] ;

ColorFunctionScaling is a SurfaceGraphics option and only affects rendering of SurfaceGraphics when the setting (Lighting→False) is used. Plot3D returns SurfaceGraphics and the next cell demonstrates the use of ColorFunctionScaling with Plot3D.

Plot3D[Cos[x y]/10 + 1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScalingTrue, Li ...  1/2, {x, -3, 3}, {y, -3, 3}, ColorFunctionScalingFalse, LightingFalse] ;


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page