VectorColorFunction
✖
VectorColorFunction
is an option for VectorPlot and related functions that specifies a function to apply to determine colors of field vectors drawn.
Details

- The setting for VectorColorFunction is applied to the coordinates associated with the center of each field vector to determine the color to use to render the field vector.
- With the setting VectorColorFunction->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 VectorPlot3D,ListVectorPlot3D x, y, z, vx, vy, vz, Norm[{vx,vy,vz}] - With the usual default setting VectorColorFunctionScaling->True, the arguments supplied to func are scaled to lie in the range 0 to 1.
- With VectorColorFunctionScaling->False, original unscaled values are used.
- VectorColorFunction->"name" is equivalent to VectorColorFunction->(ColorData["name"][#i]&) where the slot used is as follows: VectorPlot, ListVectorPlot, etc.: #5 (Norm[{vx,vy}]), VectorDensityPlot, ListVectorDensityPlot, etc.: #5 (s), VectorPlot3D and ListVectorPlot3D: #7 (Norm[{vx,vy,vz}]).
- The list of possible color function names is given by ColorData["Gradients"].
- The function specified by VectorColorFunction 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 allclose allBasic Examples (1)Summary of the most common use cases
Use any color gradient from ColorData:

https://wolfram.com/xid/0n4xegzic1u-e9j2yo

Scope (2)Survey of the scope of standard use cases
Vector color functions use the norms of the vectors by default:

https://wolfram.com/xid/0n4xegzic1u-8mzm79

Use the or
position of the vector instead:

https://wolfram.com/xid/0n4xegzic1u-7wnqz8

Use the horizontal or vertical component of the vector instead:

https://wolfram.com/xid/0n4xegzic1u-f3gpaj

By default, the vector color function uses values scaled to be between 0 and 1:

https://wolfram.com/xid/0n4xegzic1u-vgvhgs

Use unscaled values with VectorColorFunctionScaling->False:

https://wolfram.com/xid/0n4xegzic1u-1tasqc

Applications (2)Sample problems that can be solved with this function
Use VectorColorFunctionScaling and ColorFunctionScaling with contrasting colors:

https://wolfram.com/xid/0n4xegzic1u-s48hdr

Color the vectors according to the logarithm of the vector magnitude:

https://wolfram.com/xid/0n4xegzic1u-8vmcli

Properties & Relations (1)Properties of the function, and connections to other functions

https://wolfram.com/xid/0n4xegzic1u-khqme6


https://wolfram.com/xid/0n4xegzic1u-1gyzx7

Wolfram Research (2008), VectorColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorColorFunction.html.
Text
Wolfram Research (2008), VectorColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorColorFunction.html.
Wolfram Research (2008), VectorColorFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorColorFunction.html.
CMS
Wolfram Language. 2008. "VectorColorFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VectorColorFunction.html.
Wolfram Language. 2008. "VectorColorFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VectorColorFunction.html.
APA
Wolfram Language. (2008). VectorColorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VectorColorFunction.html
Wolfram Language. (2008). VectorColorFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VectorColorFunction.html
BibTeX
@misc{reference.wolfram_2025_vectorcolorfunction, author="Wolfram Research", title="{VectorColorFunction}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/VectorColorFunction.html}", note=[Accessed: 12-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_vectorcolorfunction, organization={Wolfram Research}, title={VectorColorFunction}, year={2008}, url={https://reference.wolfram.com/language/ref/VectorColorFunction.html}, note=[Accessed: 12-April-2025
]}