({{, (RefLink[VectorPlot, paclet:ref/VectorPlot])[{(Subscript[v, x]),(Subscript[v, y])},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])}] 
generates a vector plot of the vector field {(Subscript[v, x]),(Subscript[v, y])} as a function of x and y. }, {, (RefLink[VectorPlot, paclet:ref/VectorPlot])[{{(Subscript[v, x]),(Subscript[v, y])},{(Subscript[w, x]),(Subscript[w, y])},…},{x,(Subscript[x, min]),(Subscript[x, max])},{y,(Subscript[y, min]),(Subscript[y, max])}]
plots several vector fields. }, {, (RefLink[VectorPlot, paclet:ref/VectorPlot])[…,{x,y}∈reg]
takes the variables {x,y} to be in the geometric region reg. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[VectorPlot, paclet:ref/VectorPlot]) by default shows vectors from the vector field at a regular grid of positions.

(RefLink[VectorPlot, paclet:ref/VectorPlot]) omits any vectors for which the (Subscript[v, i]) etc. do not evaluate to real numbers.

(RefLink[VectorPlot, paclet:ref/VectorPlot]) treats the variables x and y as local, effectively using (RefLink[Block, paclet:ref/Block]).

(RefLink[VectorPlot, paclet:ref/VectorPlot]) has attribute (RefLink[HoldAll, paclet:ref/HoldAll]), and evaluates the (Subscript[v, i]) etc. only after assigning specific numerical values to x and y.

In some cases it may be more efficient to use (RefLink[Evaluate, paclet:ref/Evaluate]) to evaluate the (Subscript[v, i]) etc. symbolically before specific numerical values are assigned to x and y.

(RefLink[VectorPlot, paclet:ref/VectorPlot]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions and changes:

The arguments supplied to functions in (RefLink[RegionFunction, paclet:ref/RegionFunction]) and (RefLink[VectorColorFunction, paclet:ref/VectorColorFunction]) are x, y, (Subscript[v, x]), (Subscript[v, y]), (RefLink[Norm, paclet:ref/Norm])[{(Subscript[v, x]),(Subscript[v, y])}].

OpenersPrimaryExamplesSection(Spacer1)Examples  (123)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Plot the vector field {y,-x}:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3}]

Plot multiple vector fields:

VectorPlot[{{y,-x},{x,y}},{x,-3,3},{y,-3,3}]

OpenersExampleSection1(Spacer1)Scope  (19)

OpenersExampleSubsection0(Spacer1)Sampling  (9)

Plot multiple vector fields:

VectorPlot[{{x,y},{y,-x}},{x,-3,3},{y,-3,3}]

Use (RefLink[Evaluate, paclet:ref/Evaluate]) to evaluate the vector field symbolically before numeric assignment:

VectorPlot[Evaluate[D[Sin[x y],{{x,y}}]],{x,0,1},{y,0,1}]

Plot a vector field with vectors placed with specified densities:

Table[VectorPlot[{y,-x},{x,-2,2},{y,-2,2},PlotLabel->k,VectorPoints->k],{k,{5,Coarse,Automatic,Fine}}]

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

points = {{-1,-1},{-1,1},{1,-1},{1,1}};

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-2,2},{y,-2,2},VectorPoints->points,VectorScale->.25,Epilog->{Red,PointSize[Medium],Point[points]}]

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

VectorPlot[{y,-x},{x,-3,3},{y,-3,3}, VectorPoints->{4,7}]

Specify a list of points for showing field vectors:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->RandomReal[{-3,3},{300,2}],VectorScale->Large]

Plot vectors over a specified region:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},RegionFunction->Function[{x,y,vx,vy,n},x y<0]]

The domain may be specified by a region:

VectorPlot[{y,-x},{x,y}∈Disk[]]

The domain may be specified by a (RefLink[MeshRegion, paclet:ref/MeshRegion]):

𝒟=MeshRegion[{{0,0},{5,-2},{3,0},{5,2}},Polygon[{1,2,3,4}]];

VectorPlot[{Sin[x],Cos[y]},{x,y}∈𝒟]

OpenersExampleSubsection1(Spacer1)Presentation  (10)

Plot a vector field with constant size arrows:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorScale->{Automatic,Automatic,None}]

Plot a vector field with arrows of specified size:

Table[VectorPlot[{x,-y},{x,-3,3},{y,-3,3},VectorColorFunction->"BrightBands",PlotLabel->s,VectorScale->s], {s,{Small,Medium,Large,0.15}}]

Vary the arrow length and arrowhead size:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->s,VectorScale->s],{s,{{Large,1},{Large,Scaled[1]},{Large,Automatic,#1&}}}]

Plot a vector field with arrows colored according to the magnitude of the field:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorColorFunction->"Rainbow"]

Set the style for multiple vector fields:

VectorPlot[{{-1-x^2+y,1+x-y^2},{-(1+x-y^2),-1-x^2+y}},{x,-3,3},{y,-3,3},VectorPoints->8,VectorStyle->{{Orange,"Drop"},{Green,"Dart"}}]

Apply vector style:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->8,VectorStyle->Directive[Orange,Dashed]]

Use a named appearance to draw the vectors:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorMarkers->"Drop"]

Style the vectors as well:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorMarkers->"Drop",VectorStyle->Red]

Plot vectors and streamlines together:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorStyle->Red,StreamPoints->10]

Include a legend:

VectorPlot[{{y,-x},{x,y}},{x,-3,3},{y,-3,3},PlotLegends->{"one","two"}]

Use a theme with simple ticks and grid lines:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->10,PlotTheme->"Business"]

Use a theme with high-contrast colors:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->10,PlotTheme->"Marketing"]

OpenersExampleSection2(Spacer1)Options  (90)

OpenersExampleSubsection2(Spacer1)AspectRatio  (2)

By default, the aspect ratio is 1:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},AspectRatio->1]

Set the aspect ratio:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->a,AspectRatio->a],{a,{Automatic,Full,GoldenRatio}}]

OpenersExampleSubsection3(Spacer1)Background  (1)

Use colored backgrounds:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorStyle->Yellow,FrameStyle->LightGray,Background->Black]

OpenersExampleSubsection4(Spacer1)EvaluationMonitor  (2)

Show where the vector field function is sampled:

ListPlot[Reap[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},EvaluationMonitor:>Sow[{x,y}]]][[-1,1]]]

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

Block[{k=0},VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},EvaluationMonitor:>k++];k]

OpenersExampleSubsection5(Spacer1)FrameLabel  (1)

Label the axes:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},FrameLabel->{x,y}]

OpenersExampleSubsection6(Spacer1)PerformanceGoal  (2)

Generate a higher-quality plot:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PerformanceGoal->"Quality"]

Emphasize performance, possibly at the cost of quality:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PerformanceGoal->"Speed"]

OpenersExampleSubsection7(Spacer1)PlotLegends  (3)

No legends are included by default:

VectorPlot[{{x,y},{y,-x}},{x,-3,3},{y,-3,3}]

Include a legend:

VectorPlot[{{x,y},{y,-x}},{x,-3,3},{y,-3,3},PlotLegends->{"one","two"}]

Control the placement of the legend:

VectorPlot[{{x,y},{y,-x}},{x,-3,3},{y,-3,3},PlotLegends->Placed[{"one","two"},Below]]

OpenersExampleSubsection8(Spacer1)PlotRange  (8)

The full plot range is used by default:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->Full]

Specify an explicit limit for both x and y ranges:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->2]

Specify an explicit range that applies to both x and y ranges:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{-1,2.5}]

Specify an explicit x range:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{{-1,2}}]

Specify an explicit x minimum range:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{{0,Full}}]

Specify an explicit y range:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{Full,{0,2}}]

Specify an explicit y maximum range:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{Full,{Full,5}}]

Specify different x and y ranges:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotRange->{{-2,1.5},{-1,2}}]

OpenersExampleSubsection9(Spacer1)PlotTheme  (1)

Use a theme with detailed ticks and simple grid lines:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,PlotTheme->"Scientific"]

Change the vector style:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,PlotTheme->"Scientific",VectorStyle->Blue]

OpenersExampleSubsection10(Spacer1)RegionFunction  (3)

Plot vectors only over certain quadrants:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},RegionFunction->Function[{x,y,vx,vy,n},x y<0]]

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

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},RegionFunction->Function[{x,y,vx,vy,n},n>6]]

Use any logical combination of conditions:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},RegionFunction->Function[{x,y,vx,vy,n},4<n<9||0<n<2]]

OpenersExampleSubsection11(Spacer1)StreamColorFunction  (5)

Color streamlines according to the norm of the vector field:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamColorFunction->Hue]

Use any named color gradient from (RefLink[ColorData, paclet:ref/ColorData]):

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamColorFunction->"ValentineTones"]

Use (RefLink[ColorData, paclet:ref/ColorData]) for predefined color gradients:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamColorFunction->Function[{x,y,vx,vy,n},ColorData["SolarColors"][x y]]]

Specify a color function that blends two colors by the x coordinate:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamColorFunction->Function[{x,y,vx,vy,n},Blend[{Green,Red},x]]]

Use (RefLink[StreamColorFunctionScaling, paclet:ref/StreamColorFunctionScaling])->(RefLink[False, paclet:ref/False]) to get unscaled values:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamColorFunctionScaling->False,StreamPoints->Coarse,StreamColorFunction->Function[{x,y,vx,vy,n},ColorData[22][Round[n]]]]

OpenersExampleSubsection12(Spacer1)StreamColorFunctionScaling  (4)

By default, scaled values are used:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Fine,StreamColorFunction->Function[{x,y,vx,vy,n},Blend[{Green,Red},x]]]

Use (RefLink[StreamColorFunctionScaling, paclet:ref/StreamColorFunctionScaling])->(RefLink[False, paclet:ref/False]) to get unscaled values:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Fine,StreamColorFunctionScaling->False,StreamColorFunction->Function[{x,y,vx,vy,n},ColorData[22][Round[n]]]]

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

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Fine,StreamColorFunction->Function[{x,y,vx,vy,n},Hue[x,y,1]],StreamColorFunctionScaling->{False,True}]

Explicitly specify the scaling for each color function argument:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Fine,StreamColorFunction->Function[{x,y,vx,vy,n},Hue[n,y,1]],StreamColorFunctionScaling->{True,True,True,True,False}]

OpenersExampleSubsection13(Spacer1)StreamPoints  (6)

Specify a maximum number of streamlines:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->10]

Use symbolic names to specify the number of streamlines:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorStyle->Orange,StreamPoints->p,PlotLabel->p],{p,{Automatic,Coarse,Fine}}]

Use both automatic and explicit seeding with styles for explicitly seeded streamlines:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamStyle->Gray,StreamPoints->{{{{1,0},Red},{{-1,-1},Green},Automatic}}]

Specify the minimum distance between streamlines:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->d,VectorStyle->Orange,StreamPoints->{Automatic,d}],{d,{Automatic,1,Scaled[0.05]}}]

Specify the minimum distance between streamlines at the start and end of a streamline:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->d,VectorStyle->Orange,StreamPoints->{Automatic,d}],{d,{Automatic,{Scaled[0.1],Scaled[0.5]}}}]

Control the maximum length that each streamline can have:

points = Tuples[{-1,0,1},2]

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorStyle->Orange,StreamPoints->{points,Automatic,maxlen},Epilog->Point[points]],{maxlen,{2.5,Scaled[0.2]}}]

OpenersExampleSubsection14(Spacer1)StreamScale  (9)

Create full streamlines without segmentation:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorStyle->Orange,StreamPoints->10,StreamScale->Full]

Use curves for streamlines:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorStyle->Orange,StreamPoints->10,StreamScale->None]

Use symbolic names to control the lengths of streamlines:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->s,VectorPoints->8,VectorStyle->Orange,StreamPoints->Coarse,StreamScale->s],{s,{Tiny,Large}}]

Specify segment lengths:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->s,VectorPoints->8,VectorStyle->Orange,StreamPoints->Coarse,StreamScale->s],{s,{0.1,0.2,0.4}}]

Specify an explicit dashing pattern for streamlines:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorPoints->8,VectorStyle->Orange,StreamPoints->Coarse,StreamScale->{{0.1,0.1},Automatic}]

Specify the number of points rendered on each streamline segment:

Table[VectorPlot[{y,-x},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->n,VectorStyle->Orange,StreamPoints->Coarse,StreamScale->{Full,n}],{n,{10,15,All}}]

Specify absolute aspect ratios relative to the longest line segment:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorPoints->8,VectorStyle->Orange,StreamPoints->Coarse,PlotLabel->a,StreamScale->{Automatic,Automatic,a}],{a,{.02,.04}}]

Specify relative aspect ratios relative to each line segment:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorPoints->8,VectorStyle->Orange,StreamPoints->Coarse,PlotLabel->a,StreamScale->{Automatic,Automatic,a}],{a,{Scaled[0.5],Scaled[1],Scaled[1.5]}}]

Scale the length of the arrows by the y coordinate:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorScale->Tiny,VectorStyle->Orange,StreamPoints->Coarse,StreamScale->{Automatic,4,Automatic,Function[{x,y,vx,vy,n},Scaled[y]]}]

OpenersExampleSubsection15(Spacer1)StreamStyle  (8)

Apply a variety of styles to the streamlines:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamScale->Full,StreamStyle->s],{s,{Orange,Thick,Directive[Orange,Thick]}}]

Specify a custom arrowhead:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},StreamPoints->Coarse,StreamScale->Full,StreamStyle->Arrowheads[{{0.03,Automatic,Graphics[Circle[]]}}]]

Set the style for multiple vector fields:

VectorPlot[{{-1-x^2+y,1+x-y^2},{-(1+x-y^2),-1-x^2+y}},{x,-3,3},{y,-3,3},StreamPoints->20,StreamStyle->{Red,Blue}]

Use named styles:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->s,StreamPoints->Coarse,StreamScale->{Full,All,0.05},StreamStyle->s],{s,{"Segment","Line"}}]

Named arrow styles:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->s,StreamPoints->Coarse,StreamScale->{Full,All,0.05},StreamStyle->s],{s,{"Arrow","ArrowArrow","CircleArrow"}}]

Named dot styles:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->s,StreamScale->{Full,All,0.03},StreamPoints->Coarse,StreamStyle->s],{s,{"BarDot","Dot","DotArrow","DotDot"}}]

Named pointer styles:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->s,StreamScale->{Full,All,0.03},StreamPoints->Coarse,StreamStyle->s],{s,{"Drop","BackwardPointer","Pointer","Toothpick"}}]

Named dart styles:

Table[VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},PlotLabel->s,StreamScale->{Full,All,0.03},StreamPoints->Coarse,StreamStyle->s],{s,{"Dart","PinDart","DoubleDart"}}]

OpenersExampleSubsection16(Spacer1)VectorColorFunction  (4)

Color the vectors according to their norms:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Hue]

Use any named color gradient from (RefLink[ColorData, paclet:ref/ColorData]):

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->"Rainbow"]

Color the vectors according to their x values:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Function[{x,y,vx,vy,n},ColorData["ThermometerColors"][x]]]

Use (RefLink[VectorColorFunctionScaling, paclet:ref/VectorColorFunctionScaling])->(RefLink[False, paclet:ref/False]) to get unscaled values:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Function[{x,y,vx,vy,n},ColorData[22][Round[n]]],VectorColorFunctionScaling->False]

OpenersExampleSubsection17(Spacer1)VectorColorFunctionScaling  (4)

By default, scaled values are used:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Hue]

Use (RefLink[VectorColorFunctionScaling, paclet:ref/VectorColorFunctionScaling])->(RefLink[False, paclet:ref/False]) to get unscaled values:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Function[{x,y,vx,vy,n},ColorData[22][Round[n]]],VectorColorFunctionScaling->False]

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

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Function[{x,y,vx,vy,n},Hue[x,y,1]], VectorColorFunctionScaling->{False,True}]

Explicitly specify the scaling for each color function argument:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorScale->Large,VectorColorFunction->Function[{x,y,vx,vy,n},Hue[n,y,1]], VectorColorFunctionScaling->{True,True,True,True,False}]

OpenersExampleSubsection18(Spacer1)VectorMarkers  (4)

Vectors are drawn as arrows by default:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3}]

Use a named appearance to draw the vectors:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorMarkers->"Drop"]

Use different markers for different vector fields:

VectorPlot[{{y,-x },{x,y}},{x,-3,3},{y,-3,3},VectorMarkers->{"Drop","Dart"}]

By default, markers are centered on vector points:

pts=Tuples[Range[-3,3],2];

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorMarkers->"Arrow",VectorPoints->pts,Epilog->{Red,Point[pts]}]

Start the vectors at the points:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorMarkers->Placed["Arrow","Start"],VectorPoints->pts,Epilog->{Red,Point[pts]}]

End the vectors at the points:

VectorPlot[{y,-x },{x,-3,3},{y,-3,3},VectorMarkers->Placed["Arrow","End"],VectorPoints->pts,Epilog->{Red,Point[pts]}]

OpenersExampleSubsection19(Spacer1)VectorPoints  (7)

Use automatically determined vector points:

VectorPlot[{y,-x},{x,-2,2},{y,-2,2},VectorPoints->Automatic]

Use symbolic names to specify the set of field vectors:

Table[VectorPlot[{y,-x},{x,-2,2},{y,-2,2},PlotLabel->k,VectorPoints->k],{k,{Fine,Automatic,Coarse}}]

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

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorPoints->5]

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

VectorPlot[{y,-x},{x,-3,3},{y,-3,3}, VectorPoints->{4,7}]

Specify a list of points for showing field vectors:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->RandomReal[{-3,3},{300,2}],VectorScale->Large]

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

Table[VectorPlot[{y^2,x^2-y^2},{x,-3,3},{y,-3,3},PlotLabel->n,VectorPoints->n,VectorScale->Medium],{n,5,20,5}]

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

points = {{-1,-1},{-1,1},{1,-1},{1,1}};

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-2,2},{y,-2,2},VectorPoints->points,VectorScale->.25,Epilog->{Red,PointSize[Medium],Point[points]}]

OpenersExampleSubsection20(Spacer1)VectorScale  (9)

Use automatically determined vector scales:

VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorScale->Automatic]

Specify the relative size of vectors as a fraction of the diagonal of the plot range:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorPoints->10,PlotLabel->s,VectorScale->s],{s,{0.05,0.1}}]

Use symbolic names to control the size of vectors:

Table[VectorPlot[{y,-x},{x,-3,3},{y,-3,3},VectorScale->s,PlotLabel->s],{s,{Tiny,Small,Medium,Large}}]

With the vector scaling function set to (RefLink[None, paclet:ref/None]), all vectors have the same size:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->ToString[f],VectorScale->{Automatic,Automatic,f}],{f,{None,Automatic}}]

Specify an absolute size for the arrowheads:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorScale->{Large,1}]

Specify arrowhead size relative to the length of the arrow:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorScale->{Large,Scaled[1]}]

Scale the vector length by the absolute value of the x coordinate:

VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},VectorScale->{Large,Automatic,#1&}]

By default, the vector length is scaled by the norm of the vector field:

Table[VectorPlot[{Sin[x],Cos[y]},{x,-Pi,Pi},{y,-Pi,Pi},PlotLabel->len,VectorScale->{Large, Automatic, len}],{len,{Automatic,#5&}}]

Scale the vector length by the x component of the vector field:

VectorPlot[{1/(x^2+y^2),1/(x^2+y^2)},{x,-3,3},{y,-3,3},VectorScale->{Automatic,Automatic,#},PlotLabel->HoldForm[#]]& /@ {None,Function[If[#5>1,None,#5]]}

OpenersExampleSubsection21(Spacer1)VectorStyle  (7)

Set the style for the displayed vectors:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->8,VectorStyle->Red]

Set the style for multiple vector fields:

VectorPlot[{{-1-x^2+y,1+x-y^2},{-(1+x-y^2),-1-x^2+y}},{x,-3,3},{y,-3,3},VectorPoints->8,VectorStyle->{Red,Blue}]

Plot the vector fields without arrowheads:

VectorPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->8,VectorStyle->Arrowheads[0]]

Use (RefLink[Arrowheads, paclet:ref/Arrowheads]) to specify an explicit style of the arrowheads:

VectorPlot[{x,y},{x,-1,1},{y,-1,1},VectorPoints->8,PlotRange->All,VectorStyle->Arrowheads[{{0.03,Automatic,Graphics[Circle[]]}}]]

Specify both arrow tail and head:

VectorPlot[{x,y},{x,-1,1},{y,-1,1},VectorPoints->8,PlotRange->All, VectorStyle->Arrowheads[{{0.03,Automatic,Graphics[Rectangle[{-0.5,-0.5},{0.5,0.5}]]},{0.03,Automatic,Graphics[Circle[]]}}]]

Graphics primitives without (RefLink[Arrowheads, paclet:ref/Arrowheads]) are scaled based on the vector scale:

VectorPlot[{x,y},{x,-1,1},{y,-1,1},VectorPoints->8,PlotRange->All, VectorStyle->Graphics[Circle[]]]

Change the scaling using the (RefLink[VectorScale, paclet:ref/VectorScale]) option:

VectorPlot[{x,y},{x,-1,1},{y,-1,1},VectorPoints->8,PlotRange->All, VectorStyle->Graphics[Circle[]], VectorScale->{Automatic,Scaled[0.3]}]

OpenersExampleSection3(Spacer1)Applications  (6)

Gradient field of sin(x y) over the unit square:

VectorPlot[Evaluate[D[Sin[x y],{{x,y}}]],{x,0,1},{y,0,1}]

Hamiltonian vector field of sin(x y):

VectorPlot[Evaluate@{D[Sin[x y],{y}],-D[Sin[x y],{x}]}, {x, 0, 2Pi}, {y, 0, 2Pi}]

Pólya field plot of sin(z) [(WebLink[more info, http://mathworld.wolfram.com/PolyaPlot.html])]:

VectorPlot[Evaluate@{Re[Sin[x+I*y]],-Im[Sin[x+I y]]}, {x, -1, 1}, {y, -1, 1},VectorScale->{Automatic,Automatic,Log[#5+1]&}]

Pólya field plot of (z^4)-1:

VectorPlot[Evaluate@{Re[(x+I*y)^4-1],-Im[(x+I*y)^4-1]}, {x, 0, 3}, {y, 0, 3},VectorScale->{Automatic,Automatic,Log[#5+1]&}]

Characterize linear planar systems interactively:

Manipulate[Row[{Text["m"]==MatrixForm[m],VectorPlot[Evaluate[m.{x,y}],{x,-1,1},{y,-1,1}, VectorScale->{Large,Scaled[1.2]}, VectorColorFunction->"Rainbow"
]}],{{m,(({{1, 0}, {0, 2}}))}, {(({{1, 0}, {0, 2}}))->"Nodal source",(({{1, 1}, {0, 1}}))->"Degenerate source",(({{0, 1}, {-1, 1}}))->"Spiral source",(({{-1, 0}, {0, -2}}))->"Nodal sink",(({{-1, 1}, {0, -1}}))->"Degenerate sink",(({{0, 1}, {-1, -1}}))->"Spiral sink",(({{0, 1}, {-1, 0}}))->"Center",(({{1, 0}, {0, -2}}))->"Saddle"}}]

Use vectors to indicate the stability of a limit cycle:

field[{x_,y_}] = {α x-y-α x((x^2)+(y^2)), x+α y-α y((x^2)+(y^2))};

Table[VectorPlot[Evaluate[field[{x,y}]],{x,-2,2},{y,-2,2}, VectorPoints->Flatten[Table[p={Cos[2π t],Sin[2π t]};{(3/4) p, (5/4)p},{t,Range[20]/20.}],1],StreamPoints->{{{0.5,0.5}}},StreamStyle->Red,StreamScale->None,VectorScale->{Medium,Scaled[1.1]}],{α,-3,3,2}]

OpenersExampleSection4(Spacer1)Properties & Relations  (6)

Use (RefLink[ListVectorPlot, paclet:ref/ListVectorPlot]) for plotting data:

data=Table[{-1-x^2+y,1+x-y^2},{x,-3,3,0.2},{y,-3,3,0.2}];

ListVectorPlot[data,VectorPoints->8]

Use (RefLink[VectorDensityPlot, paclet:ref/VectorDensityPlot]) to add a density plot of the scalar field:

VectorDensityPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3},VectorPoints->8]

Use (RefLink[ListVectorDensityPlot, paclet:ref/ListVectorDensityPlot]) for plotting data with a density plot of the scalar field:

data=Table[{{x,y}=RandomReal[{-1.5,1.5},{2}],{{y,x-x^3},Abs[x+y]}},{300}];

ListVectorDensityPlot[data,VectorPoints->8,ColorFunction->"Pastel"]

Use (RefLink[StreamPlot, paclet:ref/StreamPlot]) to plot with streamlines instead of vectors:

StreamPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3}]

Use (RefLink[LineIntegralConvolutionPlot, paclet:ref/LineIntegralConvolutionPlot]) to plot the line integral convolution of a vector field:

LineIntegralConvolutionPlot[{-1-x^2+y,1+x-y^2},{x,-3,3},{y,-3,3}]

Use (RefLink[VectorPlot3D, paclet:ref/VectorPlot3D]) to visualize 3D vector fields:

VectorPlot3D[{x,y,z},{x,-1,1},{y,-1,1},{z,-1,1}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[VectorDensityPlot, paclet:ref/VectorDensityPlot])  ▪  (RefLink[StreamPlot, paclet:ref/StreamPlot])  ▪  (RefLink[ListVectorPlot, paclet:ref/ListVectorPlot])  ▪  (RefLink[LineIntegralConvolutionPlot, paclet:ref/LineIntegralConvolutionPlot])  ▪  (RefLink[ParametricPlot, paclet:ref/ParametricPlot])  ▪  (RefLink[ContourPlot, paclet:ref/ContourPlot])  ▪  (RefLink[DensityPlot, paclet:ref/DensityPlot])  ▪  (RefLink[Plot3D, paclet:ref/Plot3D])  ▪  (RefLink[VectorPlot3D, paclet:ref/VectorPlot3D])  ▪  (RefLink[SliceVectorPlot3D, paclet:ref/SliceVectorPlot3D])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Vector Visualization, paclet:guide/VectorVisualization])}, {▪(RefLinkPlain[Function Visualization, paclet:guide/FunctionVisualization])}, {▪(RefLinkPlain[Vector Analysis, paclet:guide/VectorAnalysis])}, {▪(RefLinkPlain[Solvers over Regions, paclet:guide/GeometricSolvers])}, {▪(RefLinkPlain[Differential Equations, paclet:guide/DifferentialEquations])}})}})