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.
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
- Pick a preset, or choose vector field or slope field and type the formulas.
- Set the x and y range.
- Choose arrows, streamlines, both, slope marks or slope marks with solution curves.
- Set the number of arrows and streamline seeds, the arrow length rule and the colours.
- Type a point to read the divergence and curl there.
- 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
| Preset | Field | x | y | Look | Arrows or marks | Streamlines | div F at the probe | curl F at the probe |
|---|---|---|---|---|---|---|---|---|
| Rotation F = (-y, x): circles | (-y, x) | -3 to 3 | -3 to 3 | arrows + streamlines | 224 | 20 | 0 | 2 |
| Source F = (x, y): straight rays out | (x, y) | -3 to 3 | -3 to 3 | arrows + streamlines | 224 | 46 | 2 | 0 |
| Sink F = (-x, -y) | (-x, -y) | -3 to 3 | -3 to 3 | arrows | 224 | – | -2 | 0 |
| Saddle F = (x, -y) | (x, -y) | -3 to 3 | -3 to 3 | arrows + streamlines | 224 | 40 | 0 | 0 |
| Spiral out F = (x – y, x + y) | (x – y, x + y) | -3 to 3 | -3 to 3 | streamlines | – | 33 | 2 | 2 |
| Spiral in F = (-x – y, x – y) | (-x – y, x – y) | -3 to 3 | -3 to 3 | streamlines | – | 33 | -2 | 2 |
| Shear F = (y, 0) | (y, 0) | -3 to 3 | -3 to 3 | arrows | 210 | – | 0 | -1 |
| F = (sin y, sin x): cells | (sin(y), sin(x)) | -6 to 6 | -6 to 6 | streamlines | – | 55 | 0 | 0 |
| Gradient of sin x cos y | (cos(x)cos(y), -sin(x)sin(y)) | -4 to 4 | -4 to 4 | arrows + streamlines | 225 | 58 | -0.909297 | 0 |
| Phase portrait: pendulum (y, -sin x) | (y, -sin(x)) | -7 to 7 | -3.5 to 3.5 | arrows + streamlines | 120 | 32 | 0 | -1.5403 |
| Phase portrait: damped pendulum | (y, -sin(x) – 0.3y) | -7 to 7 | -3.5 to 3.5 | streamlines | – | 29 | -0.3 | -1.5403 |
| Phase portrait: Van der Pol, mu 1 | (y, (1 – x^2)y – x) | -4 to 4 | -4 to 4 | streamlines | – | 38 | 0 | -4 |
| Phase portrait: predator-prey (x(1 – y), y(x – 1)) | (x(1 – y), y(x – 1)) | 0 to 3 | 0 to 3 | arrows + streamlines | 225 | 19 | 0 | 2 |
| Slope field dy/dx = x – y | dy/dx = x – y | -3 to 3 | -3 to 3 | slope marks | 441 | – | -1 | 1 |
| Slope field dy/dx = y (growth) | dy/dx = y | -3 to 3 | -3 to 3 | slope marks | 441 | – | 1 | 0 |
| Slope field dy/dx = y(1 – y) (logistic) | dy/dx = y(1 – y) | -2 to 4 | -1 to 2 | slope marks | 231 | – | -1 | 0 |
| Slope field dy/dx = x^2 – y, with solution curves | dy/dx = x^2 – y | -3 to 3 | -3 to 3 | slope marks + solution curves | 361 | 21 | -1 | 2 |
| Worksheet: arrows only, axes and labels, black | (-y, x) | -4 to 4 | -4 to 4 | arrows | 80 | – | 0 | 2 |
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) | At | div F (tool) | div F (exact) | curl F (tool) | curl F (exact) |
|---|---|---|---|---|---|
| (x²y, sin x + y³) | (1.5, 0.5) | 2.25 | 2.25 | -2.17926 | -2.17926 |
| (eˣ cos y, eˣ sin y) | (1, 1) | 2.93739 | 2.93739 | 4.57471 | 4.57471 |
| (−y/(x² + y²), x/(x² + y²)) | (1, 1) | 0 | 0 | 1.79856e-9 | 0 |
| (y², xy) | (2, 3) | 2 | 2 | -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
| Field | Drawn | Check |
|---|---|---|
| F = (−y, x): rotation | 20 streamlines, 8 close into loops | every point stays on its circle to 5 × 10^-10 |
| F = (x, y): source | 46 streamlines | every 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
| Download | What is in it |
|---|---|
| The plot on to-scale axes with labels, vector, with the formula, the divergence and curl at your point and a check bar | |
| PNG 300 DPI | The same sheet as a picture |
| SVG | Every 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 want | Use |
|---|---|
| Any field from formulas, slope fields, phase portraits | Vector Field Plotter (this page) |
| Field lines around bar and horseshoe magnets | Magnetic Field Lines |
| A blank grid | Graph Paper |
| To cut the lines on a laser or plotter | SVG 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.
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.