VectorPlot

VectorPlot[{vx,vy},{x,xmin,xmax},{y,ymin,ymax}]

generates a vector plot of the vector field {vx,vy} as a function of x and y.

VectorPlot[{{vx,vy},{wx,wy},},{x,xmin,xmax},{y,ymin,ymax}]

plots several vector fields.

VectorPlot[,{x,y}reg]

takes the variables {x,y} to be in the geometric region reg.

Details and Options

Examples

open allclose all

Basic Examples  (3)

Plot the vector field with color indicating the vector magnitude:

Include a legend for the vector magnitudes:

Use a drop-shaped marker to represent the vectors:

Scope  (19)

Sampling  (10)

Plot a vector field with vectors placed with specified densities:

Sample the vector field on a regular grid of points:

Sample the vector field on an irregular mesh:

Specify how many vector points to use in each direction:

Plot the vectors that go through a set of seed points:

Increase the number of points in an alternate point generation scheme:

Plot vectors over a specified region:

The domain may be specified by a region:

The domain may be specified by a MeshRegion:

Plot multiple vector fields:

Use Evaluate to evaluate the vector field symbolically before numeric assignment:

Presentation  (9)

Plot a vector field with automatically scaled arrows:

Use a single color for the arrows:

Plot a vector field with arrows of specified size:

Change the overall shape of the markers:

Change the default color function:

Include a legend:

Apply vector style:

Include a legend for multiple vector fields:

Use a theme with simple ticks and grid lines:

Options  (63)

AspectRatio  (2)

By default, the aspect ratio is 1:

Set the aspect ratio:

Background  (1)

Use colored backgrounds:

ClippingStyle  (4)

Vectors are clipped via VectorRange. The default clipping style is automatically chosen:

Do not show clipped vectors:

Specify the style for clipped vectors:

Color upper and lower clipped vectors differently:

EvaluationMonitor  (2)

Show where the vector field function is sampled:

Count the number of times the vector field function is evaluated:

FrameLabel  (1)

Label the axes:

PlotLegends  (4)

No legends are included by default:

Include a legend to show the color range of vector norms:

Include a legend for multiple datasets:

Control the placement of the legend:

PlotRange  (5)

The full plot range is used by default:

Specify an explicit limit for both and ranges:

Specify an explicit range:

Specify an explicit maximum range:

Specify different and ranges:

PlotTheme  (1)

Use a theme with detailed ticks and axes:

Add automatic GridLines:

RegionFunction  (4)

Plot vectors only over a certain region:

Modify the method by which field points are generated to better reflection the boundary of the region:

Plot vectors only over regions where the field magnitude is above a given threshold:

Use any logical combination of conditions:

VectorAspectRatio  (2)

The default aspect ratio for a vector marker is 1/4:

Increase the relative width of a vector marker:

VectorColorFunction  (4)

Color the vectors according to their norms:

Use any named color gradient from ColorData:

Color the vectors according to their values:

Use VectorColorFunctionScalingFalse to get unscaled values:

VectorColorFunctionScaling  (4)

By default, scaled values are used:

Use VectorColorFunctionScalingFalse to get unscaled values:

Use unscaled coordinates in the direction and scaled coordinates in the direction:

Explicitly specify the scaling for each color function argument:

VectorMarkers  (4)

Vectors are drawn as arrows by default:

Use a named appearance to draw the vectors:

Use different markers for different vector fields:

By default, markers are centered on vector points:

Start the vectors at the points:

End the vectors at the points:

VectorPoints  (10)

Use automatically determined vector points:

Use symbolic names to specify the set of field vectors:

Create a regular grid of field vectors with the same number of arrows for and :

Create a regular grid of field vectors with a different number of arrows for and :

Specify a list of points for showing field vectors:

Use a different number of field vectors on a regular grid:

The location for vectors is given in the middle of the drawn vector:

Use a hexagonal mesh instead of a rectangular mesh:

Use a mesh generated from a triangularization of the region:

Use "Mesh" to better represent the boundary of a region:

VectorRange  (4)

The clipping of vectors with very small or very large magnitudes is done automatically:

Specify the range of vector norms:

Suppress the clipped vectors:

Show all the vectors:

VectorScaling  (2)

Use automatically determined vector scales:

With the vector scaling function set to None, all vectors have the same size:

VectorSizes  (2)

The sizes of the displayed vector is determined automatically:

Specify the range of arrow lengths:

VectorStyle  (7)

Set the style for the displayed vectors:

Set the style for multiple vector fields:

Plot the vector fields without arrowheads:

Use Arrowheads to specify an explicit style of the arrowheads:

Specify both arrow tail and head:

Graphics primitives without Arrowheads are scaled based on the vector scale:

Change the scaling using the VectorScaling option:

Applications  (10)

Gradient field of over the unit square:

Hamiltonian vector field of :

Plot the direction field for the logistic differential equation :

Add several solution curves:

Plot the direction field for a differential equation that is only defined over a specific subset of the -plane, :

Pólya field plot of [more info]:

Pólya field plot of :

Characterize linear planar systems interactively:

Use vectors to indicate the stability of a limit cycle:

Display the electric field for two point charges:

Show the direction field for a frictionless pendulum satisfying :

Properties & Relations  (8)

Use ListVectorPlot for plotting data:

Use StreamPlot to plot with streamlines instead of vectors:

Use VectorDensityPlot to add a density plot of the scalar field:

Use ListVectorDensityPlot for plotting data with a density plot of the scalar field:

Use LineIntegralConvolutionPlot to plot the line integral convolution of a vector field:

Use VectorPlot3D to visualize 3D vector fields:

Plot vectors along surfaces with SliceVectorPlot3D:

Plot complex numbers as a vector field:

Introduced in 2008
 (7.0)
 |
Updated in 2012
 (9.0)
2014
 (10.0)
2018
 (11.3)
2020
 (12.1)