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 :

In[1]:=
Click for copyable input
Out[1]=

Use StreamPlot to plot streamlines:

In[2]:=
Click for copyable input
Out[2]=

Use the StreamPoints option to plot selected streamlines:

In[3]:=
Click for copyable input
Out[3]=

Use the StreamPoints option to select streamlines in the plot:

In[4]:=
Click for copyable input
Out[4]=

Use VectorDensityPlot and StreamDensityPlot to visualize the field densities:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=

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

In[7]:=
Click for copyable input
Out[7]=
    

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:

In[1]:=
Click for copyable input
Out[1]=

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

In[2]:=
Click for copyable input
Out[2]=

Combine vectors and streamlines into a single plot:

In[3]:=
Click for copyable input
Out[3]=

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

In[4]:=
Click for copyable input
Out[4]=

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:

In[5]:=
Click for copyable input
Out[5]=

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 with VectorColorFunction, where represents the variable number.

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

In[6]:=
Click for copyable input
Out[6]=

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

In[7]:=
Click for copyable input
Out[7]=

Plot streamlines from a specified point, in one direction:

In[8]:=
Click for copyable input
Out[8]=

Use VectorStyle to get 3D effects in VectorPlot3D:

In[9]:=
Click for copyable input
Out[9]=