is an option for StreamPlot and related functions that specifies a function to apply to determine colors along streamlines.
StreamColorFunction
is an option for StreamPlot and related functions that specifies a function to apply to determine colors along streamlines.
Details
- The setting for StreamColorFunction is applied at each point along each streamline to determine the color to use to render the streamline.
- With the setting StreamColorFunction->func, the arguments supplied to func are as follows:
-
VectorPlot,ListVectorPlot, StreamPlot,ListStreamPlot, LineIntegralConvolutionPlot, ListLineIntegralConvolutionPlot x, y, vx, vy, Norm[{vx,vy}] VectorDensityPlot, ListVectorDensityPlot,StreamDensityPlot, ListStreamDensityPlot x, y, vx, vy, s ComplexStreamPlot Re[z],Im[z],Abs[z],Arg[z],Re[f],Im[f],Abs[f] - With the usual default setting StreamColorFunctionScaling->True, the arguments supplied to func are scaled to lie in the range 0 to 1.
- With StreamColorFunctionScaling->False, original unscaled values are used.
- StreamColorFunction->"name" is equivalent to StreamColorFunction->(ColorData["name"][#5]&).
- The list of possible color function names is given by ColorData["Gradients"].
- The function specified by StreamColorFunction 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,…].
Examples
open all close allBasic Examples (3)
By default, streamlines are colored according to the norm of the vector field:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}]Use any color gradient from ColorData:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}, StreamColorFunction -> "Rainbow"]Color streamlines according to the norm of the vector field:
StreamDensityPlot[{Sin[x], Cos[y]}, {x, -3, 3}, {y, -3, 3}, StreamColorFunction -> Hue]Scope (6)
Define a one-dimensional color function:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}, StreamColorFunction -> (Blend[{Red, Green, Blue}, #5]&)]Define a two-dimensional color function:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}, StreamColorFunction -> (Opacity[#5, Blend[{Red, Green, Blue}, Norm[{#1, #2}]]]&)]By default, the parameters are scaled to be between 0 and 1:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -1, 1}, {y, -1, 1}, StreamColorFunction -> (ColorData["Rainbow", Norm[{#1, #2}]]&)]Use StreamColorFunctionScaling->False to use the unscaled values:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -1, 1}, {y, -1, 1}, StreamColorFunction -> (ColorData["Rainbow", Norm[{#1, #2}]]&), StreamColorFunctionScaling -> False]Combine the color function with other styles using StreamStyle:
StreamPlot[{-1 - x ^ 2 + y, 1 + x - y ^ 2}, {x, -3, 3}, {y, -3, 3}, StreamColorFunction -> "Rainbow", StreamStyle -> Thick]Style streamlines in density stream plots:
StreamDensityPlot[{x + y, -x + y}, {x, -5, 5}, {y, -5, 5}, ColorFunction -> GrayLevel, StreamColorFunction -> (ColorData["BrightBands", #5]&)]Tech Notes
Related Guides
History
Text
Wolfram Research (2008), StreamColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/StreamColorFunction.html.
CMS
Wolfram Language. 2008. "StreamColorFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StreamColorFunction.html.
APA
Wolfram Language. (2008). StreamColorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StreamColorFunction.html
BibTeX
@misc{reference.wolfram_2026_streamcolorfunction, author="Wolfram Research", title="{StreamColorFunction}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/StreamColorFunction.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_streamcolorfunction, organization={Wolfram Research}, title={StreamColorFunction}, year={2008}, url={https://reference.wolfram.com/language/ref/StreamColorFunction.html}, note=[Accessed: 15-June-2026]}