ColorDataFunction[range,…]
is a function that represents a color scheme.
ColorDataFunction
ColorDataFunction[range,…]
is a function that represents a color scheme.
Details
- ColorDataFunction works like Function.
- ColorDataFunction[…][par] finds the color corresponding to parameter par in the color scheme represented by the ColorDataFunction.
- ColorData["scheme"] gives a ColorDataFunction object.
Examples
open all close allBasic Examples (3)
ColorData returns a ColorDataFunction object:
ColorData["LightTemperatureMap"]Return a color when the specific parameters are applied:
f = ColorData["HTML"]f["Azure"]Define a color function for the plot:
f = ColorData["DarkRainbow"]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, ColorFunction -> f]Scope (5)
ColorData returns a ColorDataFunction object:
ColorData["GrayYellowTones"]ColorData[12]ColorData["HTML"]ColorData["VisibleSpectrum"]ColorDataFunction returns RGB colors when applied to values within a specific range:
ColorData["GrayYellowTones"][.5]ColorData[5][7]ColorData["HTML"]["WhiteSmoke"]ColorData["VisibleSpectrum"][550]Gradients and physical schemes are defined on continuous intervals:
ColorData["GrayYellowTones", "Range"]f = ColorData["GrayYellowTones"]f[.5]ColorData["VisibleSpectrum", "Range"]g = ColorData["VisibleSpectrum"]g[600]Indexed schemes are defined at discrete values:
ColorData[3, "Range"]Range@@%f = ColorData[3]f[5]Named schemes are defined at specific sets of values:
Short[ColorData["HTML", "Range"]]f = ColorData["HTML"]f["Maroon"]Properties & Relations (2)
ColorDataFunction from gradients and physical schemes clips values outside of the ranges:
f = ColorData["WatermelonColors"]DensityPlot[x, {x, -1, 2}, {y, 0, 1}, ColorFunction -> (f[#]&), ColorFunctionScaling -> False]ColorDataFunction from indexed schemes repeats the colors periodically:
f = ColorData[32]ArrayPlot[{Range[40]}, ColorFunction -> f, ColorFunctionScaling -> False, AspectRatio -> .3]Possible Issues (1)
In a plot with multiple ColorFunction slots, the first slot is chosen, if not specified:
f = ColorData["Rainbow"]Plot3D[ Exp[1 - x^2 - y^2], {x, -2, 2}, {y, -2, 2}, ColorFunction -> f, PlotRange -> All, Mesh -> None]Specify a pure function so that the plot is colored by height values:
Plot3D[ Exp[1 - x^2 - y^2], {x, -2, 2}, {y, -2, 2}, ColorFunction -> Function[{x, y, z}, f[z]], PlotRange -> All, Mesh -> None]See Also
Related Guides
History
Text
Wolfram Research (2007), ColorDataFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorDataFunction.html.
CMS
Wolfram Language. 2007. "ColorDataFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ColorDataFunction.html.
APA
Wolfram Language. (2007). ColorDataFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorDataFunction.html
BibTeX
@misc{reference.wolfram_2026_colordatafunction, author="Wolfram Research", title="{ColorDataFunction}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ColorDataFunction.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_colordatafunction, organization={Wolfram Research}, title={ColorDataFunction}, year={2007}, url={https://reference.wolfram.com/language/ref/ColorDataFunction.html}, note=[Accessed: 13-June-2026]}