Vector Field Plotter

Plot a 2-D vector field from two formulas, P(x, y) and Q(x, y), or a slope field from dy/dx = f(x, y), and print it for notes, worksheets or a poster. The tool draws arrows on a grid (all the same length, or longer where the field is stronger), streamlines traced along the field with the fourth-order Runge–Kutta method, and slope marks with solution curves for differential equations; phase portraits such as the pendulum, the Van der Pol oscillator and predator–prey are presets. It also works out the divergence and curl at any point you choose. Axes are drawn to scale, with labels. Download a PDF, a 300 DPI PNG or an SVG. Your formulas are read by our own parser, never run as code, and nothing is uploaded.

100% private — everything runs in your browser. Everything runs in your browser; nothing is uploaded.

100% private — runs in your browser

Print at 100% (Actual size). Axes are drawn to scale: one unit is the same length across and up. The SVG holds every arrow and streamline as a path.

Field

Use x, y, numbers, + − * / ^, brackets, pi, e and sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, ln, sqrt, abs, sign, atan2, min, max, pow. 2x and x(1 − y) mean times.

Look

Divergence and curl

Page

Runs in your browser with our own code: nothing you type is uploaded or saved. Your formulas are read by our own parser (they are never run as code). You may use what you make here, including commercially, with no credit needed.

How to plot and print a vector field

  1. Pick a preset, or choose vector field or slope field and type the formulas.
  2. Set the x and y range.
  3. Choose arrows, streamlines, both, slope marks or slope marks with solution curves.
  4. Set the number of arrows and streamline seeds, the arrow length rule and the colours.
  5. Type a point to read the divergence and curl there.
  6. Download the PDF and print at 100% (Actual size), or the PNG or SVG.

What you can use it for

  • Calculus and physics worksheets on vector fields
  • Slope fields for differential equations homework and answer keys
  • Phase portraits for dynamics and ODE courses
  • Checking a divergence or curl by hand
  • Plotter and laser art from the streamline SVG
  • Flowing-line posters and prints

The 18 presets

PresetFieldxyLookArrows or marksStreamlinesdiv F at the probecurl F at the probe
Rotation F = (-y, x): circles(-y, x)-3 to 3-3 to 3arrows + streamlines2242002
Source F = (x, y): straight rays out(x, y)-3 to 3-3 to 3arrows + streamlines2244620
Sink F = (-x, -y)(-x, -y)-3 to 3-3 to 3arrows224–-20
Saddle F = (x, -y)(x, -y)-3 to 3-3 to 3arrows + streamlines2244000
Spiral out F = (x – y, x + y)(x – y, x + y)-3 to 3-3 to 3streamlines–3322
Spiral in F = (-x – y, x – y)(-x – y, x – y)-3 to 3-3 to 3streamlines–33-22
Shear F = (y, 0)(y, 0)-3 to 3-3 to 3arrows210–0-1
F = (sin y, sin x): cells(sin(y), sin(x))-6 to 6-6 to 6streamlines–5500
Gradient of sin x cos y(cos(x)cos(y), -sin(x)sin(y))-4 to 4-4 to 4arrows + streamlines22558-0.9092970
Phase portrait: pendulum (y, -sin x)(y, -sin(x))-7 to 7-3.5 to 3.5arrows + streamlines120320-1.5403
Phase portrait: damped pendulum(y, -sin(x) – 0.3y)-7 to 7-3.5 to 3.5streamlines–29-0.3-1.5403
Phase portrait: Van der Pol, mu 1(y, (1 – x^2)y – x)-4 to 4-4 to 4streamlines–380-4
Phase portrait: predator-prey (x(1 – y), y(x – 1))(x(1 – y), y(x – 1))0 to 30 to 3arrows + streamlines2251902
Slope field dy/dx = x – ydy/dx = x – y-3 to 3-3 to 3slope marks441–-11
Slope field dy/dx = y (growth)dy/dx = y-3 to 3-3 to 3slope marks441–10
Slope field dy/dx = y(1 – y) (logistic)dy/dx = y(1 – y)-2 to 4-1 to 2slope marks231–-10
Slope field dy/dx = x^2 – y, with solution curvesdy/dx = x^2 – y-3 to 3-3 to 3slope marks + solution curves36121-12
Worksheet: arrows only, axes and labels, black(-y, x)-4 to 4-4 to 4arrows80–02

Counts and the divergence and curl (at the probe point of each preset) are worked out by the tool on US Letter.

Divergence and curl, checked against the exact values

F = (P, Q)Atdiv F (tool)div F (exact)curl F (tool)curl F (exact)
(x²y, sin x + y³)(1.5, 0.5)2.252.25-2.17926-2.17926
(eˣ cos y, eˣ sin y)(1, 1)2.937392.937394.574714.57471
(−y/(x² + y²), x/(x² + y²))(1, 1)001.79856e-90
(y², xy)(2, 3)22-3-3

Exact values by hand: for (x²y, sin x + y³), div = 2xy + 3y² and curl = cos x − x². Values are rounded to 6 significant figures.

Streamline checks

FieldDrawnCheck
F = (−y, x): rotation20 streamlines, 8 close into loopsevery point stays on its circle to 5 × 10^-10
F = (x, y): source46 streamlinesevery line lies on a straight line through 0 (off by under 2 × 10^-14)

Our tests also check that every traced step runs along F and that every line stays inside the frame.

What prints

DownloadWhat is in it
PDFThe plot on to-scale axes with labels, vector, with the formula, the divergence and curl at your point and a check bar
PNG 300 DPIThe same sheet as a picture
SVGEvery arrow, slope mark and streamline as a path, with the axes and labels

To print an empty grid for your own sketch, use Graph Paper; to edit the lines, use the SVG Path Editor.

Which tool to use

You wantUse
Any field from formulas, slope fields, phase portraitsVector Field Plotter (this page)
Field lines around bar and horseshoe magnetsMagnetic Field Lines
A blank gridGraph Paper
To cut the lines on a laser or plotterSVG to DXF

Other tools: Graph Paper prints grids, and SVG to DXF turns the SVG into a DXF for cutters.

More free tools

Maths art and printables?

Drawing and print tools that run privately in your browser, with no sign-up and no watermark.

See all free tools →

Frequently asked questions

What is a vector field?

A vector field gives an arrow at every point of the plane: F(x, y) = (P(x, y), Q(x, y)). P is the part across and Q the part up. This page draws those arrows on a grid, and streamlines, which are curves that follow the arrows everywhere.

What can I type?

Formulas in x and y with numbers, + − * / and ^ for powers, brackets, pi and e, and the functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log, ln, sqrt, abs, sign, atan2, min, max, pow. You can write 2x or x(1 − y) for times. The page reads the formula with its own parser and never runs it as code, so anything else, such as words it does not know, is refused with a message.

How are streamlines drawn?

Each streamline starts from a grid of seed points and is traced both ways with fourth-order Runge–Kutta steps along the direction of F, each 1/600 of the plot width, shorter at sharp bends. A line stops at the edge, where F is zero, where it closes into a loop, or when it comes within half the seed spacing of another line, so lines stay apart. Our tests check that every step runs along F, that the lines of F = (−y, x) are circles and those of F = (x, y) are straight rays (see the table below).

How are divergence and curl worked out?

At the point you type, by central differences with a step of 1/100,000 of the plot width: div F = ∂P/∂x + ∂Q/∂y and curl F = ∂Q/∂x − ∂P/∂y (the part of the 3-D curl that points out of the page). Our tests check them against the exact values on several fields, listed below.

What is a slope field?

For a differential equation dy/dx = f(x, y), a slope field draws a short line at each grid point with slope f(x, y). It is the vector field (1, f) drawn without arrow heads. The solution curves option traces curves that follow the slope marks.

What is a phase portrait?

For a system dx/dt = P(x, y), dy/dt = Q(x, y), the phase portrait is the vector field (P, Q) with its trajectories. The pendulum, damped pendulum, Van der Pol and predator–prey presets are phase portraits.

Arrow length: same or by strength?

Same length shows only the direction. Longer where |F| is bigger makes each arrow’s length proportional to |F|, with the longest arrow 0.9 of a grid cell. Colour by strength shades the arrows from light (weak) to dark (strong) either way.

Is this the same as the magnetic field lines tool?

No. That page draws the field of bar and horseshoe magnets from a fixed pole model. This page plots any field you type, slope fields and phase portraits, with axes, labels and a divergence and curl readout.

Is it free?

Yes. There is no sign-up, no watermark and no limit.

Is anything uploaded?

No. Every arrow, line and band is worked out by JavaScript in your browser. Nothing you type is sent anywhere or saved when you close the page.