Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
ColorFunction
  • See Also
    • ColorFunctionScaling
    • MeshShading
    • PlotStyle
    • NormalsFunction
    • Blend
    • ColorData
    • LightDarkAutoColorRules
  • Related Guides
    • Colors
    • Plotting Options
    • Vector Visualization
    • Graphics Options & Styling
    • Financial Visualization
    • Chart Styling & Layout
  • Tech Notes
    • Density and Contour Plots
    • See Also
      • ColorFunctionScaling
      • MeshShading
      • PlotStyle
      • NormalsFunction
      • Blend
      • ColorData
      • LightDarkAutoColorRules
    • Related Guides
      • Colors
      • Plotting Options
      • Vector Visualization
      • Graphics Options & Styling
      • Financial Visualization
      • Chart Styling & Layout
    • Tech Notes
      • Density and Contour Plots

ColorFunction

is an option for graphics functions that specifies a function to apply to determine colors of elements.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Applications  
Properties & Relations  
Possible Issues  
See Also
Tech Notes
Related Guides
Related Links
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ColorFunctionScaling
    • MeshShading
    • PlotStyle
    • NormalsFunction
    • Blend
    • ColorData
    • LightDarkAutoColorRules
  • Related Guides
    • Colors
    • Plotting Options
    • Vector Visualization
    • Graphics Options & Styling
    • Financial Visualization
    • Chart Styling & Layout
  • Tech Notes
    • Density and Contour Plots
    • See Also
      • ColorFunctionScaling
      • MeshShading
      • PlotStyle
      • NormalsFunction
      • Blend
      • ColorData
      • LightDarkAutoColorRules
    • Related Guides
      • Colors
      • Plotting Options
      • Vector Visualization
      • Graphics Options & Styling
      • Financial Visualization
      • Chart Styling & Layout
    • Tech Notes
      • Density and Contour Plots

ColorFunction

ColorFunction

is an option for graphics functions that specifies a function to apply to determine colors of elements.

Details

  • With ColorFunction->func, the arguments supplied to func are as follows:
  • Rastera
    Plot,ListLinePlot,ListLogPlotx, y
    ParametricPlotx, y, u or x, y, u, v
    RegionPlotx, y
    ArrayPlot,ReliefPlota
    ContourPlot,ListContourPlotf contour levels
    DensityPlot,ListDensityPlotf
    ContourPlot3D,ListContourPlot3Dx, y, z, f
    Plot3D,ListPlot3D,ListSurfacePlot3D,ListPointPlot3Dx, y, z
    ParametricPlot3Dx, y, z, u or x, y, z, u, v
    RegionPlot3Dx, y, z
    Image3D,Raster3Da
  • With the usual default setting ColorFunctionScaling->True, all arguments supplied to func are scaled to lie in the range 0 to 1.
  • With ColorFunctionScaling->False, original unscaled values are used.
  • ColorFunction->"name" is equivalent to ColorFunction->(ColorData["name"][#i]&) where the slot used is as follows: Plot, ListPlot, etc.: #2 (); ArrayPlot, ReliefPlot: #1 (); ContourPlot, DensityPlot, etc.: #1 (); ContourPlot3D, etc.: #4 (); Plot3D, etc.: #3 ().
  • The list of possible color function names is given by ColorData["Gradients"].
  • The function specified by ColorFunction must return color directives such as RGBColor and Hue or named colors such as Red and Blue.
  • It can also return Opacity, as well as Glow and Specularity.
  • Combinations of directives can be specified using Directive[g1,g2,…].
  • In 3D graphics, ColorFunction by default specifies diffuse colors for surfaces.
  • If an explicit setting is given for ColorRules, MeshShading, or ContourShading, it is used in preference to the setting for ColorFunction.

Examples

open all close all

Basic Examples  (5)

Color the surface by height:

Wolfram Language code: Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> Function[{x, y, z}, Hue[z]]]

Use predefined gradients:

Wolfram Language code: Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> "BlueGreenYellow"]
Wolfram Language code: DensityPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> "BlueGreenYellow"]

Color a curve:

Wolfram Language code: Plot[Sinc[x], {x, 0, 10}, PlotStyle -> Thick, ColorFunction -> Function[{x, y}, ColorData["NeonColors"][y]]]

Color a matrix:

Wolfram Language code: ArrayPlot[RandomReal[1, {10, 20}], ColorFunction -> "Rainbow"]

Color a 3D volume:

Wolfram Language code: Image3D[ExampleData[{"TestImage3D", "CTengine"}], ColorFunction -> "RainbowOpacity"]

Applications  (1)

Define a one-dimensional color function:

Wolfram Language code: CoolColor[ z_ ] := RGBColor[z, 1 - z, 1];
Wolfram Language code: ContourPlot[Sin[x y], {x, -1, 1}, {y, -1, 1}, ColorFunction -> CoolColor]
Wolfram Language code: DensityPlot[Sin[x y], {x, -1, 1}, {y, -1, 1}, ColorFunction -> CoolColor]

Properties & Relations  (1)

Use predefined color gradients from ColorData:

Wolfram Language code: GraphicsGrid[Partition[Tooltip[ColorData[#, "Image"], #]& /@ ColorData["Gradients"], 3], ImageSize -> 300]

Possible Issues  (1)

By default, the arguments to ColorFunction are rescaled to be between 0 and 1:

Wolfram Language code: Plot3D[x * y, {x, -6, 6}, {y, -6, 6}, ColorFunction -> Function[{x, y, z}, If[TrueQ[x * y > 0], Blue, Green]]]

Turn off ColorFunctionScaling to keep the original values:

Wolfram Language code: Plot3D[x * y, {x, -6, 6}, {y, -6, 6}, ColorFunction -> Function[{x, y, z}, If[TrueQ[x * y > 0], Blue, Green]], ColorFunctionScaling -> False]

See Also

ColorFunctionScaling  MeshShading  PlotStyle  NormalsFunction  Blend  ColorData  LightDarkAutoColorRules

Function Repository: DivergentColorFunction  CompileColorFunction  CubehelixColorFunction

Tech Notes

    ▪
  • Density and Contour Plots

Related Guides

    ▪
  • Colors
  • ▪
  • Plotting Options
  • ▪
  • Vector Visualization
  • ▪
  • Graphics Options & Styling
  • ▪
  • Financial Visualization
  • ▪
  • Chart Styling & Layout

Related Links

  • An Elementary Introduction to the Wolfram Language : Pure Anonymous Functions

History

Introduced in 1991 (2.0) | Updated in 1999 (4.0) ▪ 2000 (4.1) ▪ 2002 (4.2) ▪ 2007 (6.0) ▪ 2012 (9.0)

Wolfram Research (1991), ColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorFunction.html (updated 2012).

Text

Wolfram Research (1991), ColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorFunction.html (updated 2012).

CMS

Wolfram Language. 1991. "ColorFunction." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/ColorFunction.html.

APA

Wolfram Language. (1991). ColorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorFunction.html

BibTeX

@misc{reference.wolfram_2026_colorfunction, author="Wolfram Research", title="{ColorFunction}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/ColorFunction.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

@online{reference.wolfram_2026_colorfunction, organization={Wolfram Research}, title={ColorFunction}, year={2012}, url={https://reference.wolfram.com/language/ref/ColorFunction.html}, note=[Accessed: 01-September-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English