How to | Plot a Vector Field

You can visualize a vector field by plotting vectors on a regular grid, by plotting a selection of streamlines, or by using a gradient color scheme to illustrate vector and streamline densities. You can also plot a vector field from a list of vectors as opposed to a mapping.

Use VectorPlot to plot vectors in a vector field given by a mapping from to :

Use StreamPlot to plot streamlines:

Use the StreamPoints option to plot selected streamlines:

Use the StreamPoints option to select streamlines in the plot:

Use VectorDensityPlot and StreamDensityPlot to visualize the field densities:

Use VectorPlot3D to plot a three-dimensional vector field (vectors are colored depending on their magnitude):

    

In addition to simply plotting vector fields, the Wolfram Language allows you to fine-tune these plots. These examples illustrate some of the options that can be applied.

Use VectorStyle to change the type of arrows in VectorPlot:

Use StreamPoints to control the number of streamlines in the plot:

Combine vectors and streamlines into a single plot:

Use ColorFunction to apply a color scheme based on the density of vectors and streamlines:

You can use VectorColorFunction to choose a color scheme and specify a function with which to color the vectors. This makes two plots colored with the "DarkRainbow" color scheme, each according to the functions specified in VectorColorFunction:

Because some functions used in VectorColorFunction are common, the Wolfram Language allows you to call them as variables. These are represented by integers ranging from 1 to 5, where 1 is the variable, 2 is the variable, 3 is the first field component, 4 is the second field component, and 5 is the vector magnitude. To specify these variables, use #n& with VectorColorFunction, where n represents the variable number.

Color the plot according to the second field component (#4&), with the "DarkRainbow" color scheme:

Color the plot according to the vector magnitude (#5&), also with the "DarkRainbow" color scheme:

Plot streamlines from a specified point, in one direction:

Use VectorStyle to get 3D effects in VectorPlot3D:

Specify markers with VectorMarkers: