LabCanvas
Free account · save your work, full figure editorSign up free

Contour plot and 2D colour map maker

Paste a grid of Z values (X across the first row, Y down the first column, as Excel lays out a surface) or three columns of scattered X, Y, Z points, and the tool draws a filled contour plot with labelled contour lines and a colour bar, or a smooth 2D colour map. Scattered points are interpolated onto a 60 × 60 grid by Delaunay triangulation (linear, as SciPy’s griddata) and the map is clipped to their convex hull; the levels are chosen as Matplotlib chooses them. Download a 300 or 600 dpi PNG or open it in the LabCanvas Graph app.

What it does
Draws Z over X and Y as filled contours with labelled lines or a smooth colour map, from a grid or from scattered X, Y, Z points.
Formula
z(x,y)=λ1z1+λ2z2+λ3z3λ1+λ2+λ3=1
Example
A 13 × 12 response-surface grid of reaction yield (55.5% to 83.8%) is drawn with 11 levels from 54% to 84% in steps of 3%, the same levels Matplotlib’s contourf picks.

Last updated

FreeNo sign-upRuns in your browserFigures

Loading Contour plot maker…

At a glance

Contour plot maker at a glance
InputA grid (X across the top, Y down the side, Z in the cells) or X, Y, Z columns
InterpolationDelaunay triangulation, linear, onto a 60 × 60 grid, clipped to the hull
DrawingFilled contours with labelled lines or a smooth colour map, colour bar
AccuracyInterpolation matches SciPy griddata to 10⁻⁹; levels equal Matplotlib’s
ExportPNG at 300 or 600 dpi, CSV of the grid; editable in the Graph app
Runs inYour web browser; nothing is uploaded
PriceFree, no account needed

What it does

How to use the contour plot maker

  1. Choose the layoutA grid (matrix) if your Z values are on a regular X–Y grid; X, Y, Z columns for measurements at scattered positions.
  2. Paste your valuesClick the top-left cell and paste from Excel. For a grid, the first row holds the X values and the first column the Y values; name the axes underneath.
  3. Pick the look and exportFilled contours or a smooth colour map, the colour scale and the number of levels; then download the PNG, copy the grid or open it in the Graph app.

How it works

Grids. A matrix is read as a surface: each row is one Y value (its first cell), each column one X value (its header), each cell z(x,y). Rows and columns are sorted, so they can be pasted in any order and spaced unevenly. Missing cells are left as gaps.

Scattered points. Measurements at irregular positions (wells, sampling stations, a design of experiments) are first joined into a Delaunay triangulation, in which no point lies inside the circumcircle of any triangle (the triangulation SciPy computes with the Quickhull algorithm of Barber et al. 1996, which the tool’s own is checked against). Each node of a 60 × 60 grid spanning the points is then interpolated linearly inside the triangle that contains it:

z=λ1z1+λ2z2+λ3z3,λ1+λ2+λ3=1

where λi are the node’s barycentric coordinates. X and Y are rescaled to the unit square first, so axes in different units weigh the same (SciPy’s rescale=True). Outside the convex hull of the points there is no data, so the map is clipped to the hull.

Levels and colours. Contour levels are placed at round values, about the number you ask for (10 by default), as Matplotlib’s contourf does; each band between two levels gets one colour of the scale, and the lines are labelled. A smooth colour map colours every cell instead of bands. Use a perceptually uniform scale such as viridis or cividis for ordered data, and a diverging scale centred on zero for values above and below a midpoint; rainbow scales create false boundaries (Crameri et al. 2020).

Accuracy. The surface, levels and drawing are the LabCanvas Graph app’s contour graph, run in your browser. On the groundwater example the interpolated grid matches SciPy’s griddata(method="linear") at every node inside the hull to 10⁻⁹, and the levels of both examples equal Matplotlib’s (scripts/contour-plot-maker-check.ts).

Sources: Barber CB, Dobkin DP, Huhdanpaa H. The Quickhull algorithm for convex hulls. ACM Trans Math Softw 1996;22:469–483, doi:10.1145/235815.235821. Crameri F, Shephard GE, Heron PJ. The misuse of colour in science communication. Nat Commun 2020;11:5444, doi:10.1038/s41467-020-19160-7.

Worked example: a response surface and a groundwater map

A grid. The built-in example (synthetic, labelled as demo data) is the yield of a reaction predicted by a quadratic response-surface model over temperature (40 to 100 °C, every 5 °C, across the top) and time (10 to 120 min, every 10 min, down the side): a 13 × 12 grid with yields from 55.5% to 83.8%. Asking for about 10 levels gives 11 levels from 54% to 84% in steps of 3%; the highest band (81–84%) marks the optimum, around 80–90 °C and 80–90 min.

How to lay out a grid
Time \ Temperature404550…
1055.559.462.9…
2058.562.365.7…
…………

Scattered points. Switch to X, Y, Z columns for the second example: nitrate (mg/L) measured at 70 wells at irregular positions. The points are triangulated, interpolated onto a 60 × 60 grid and drawn with levels every 4 mg/L; the dots show where the wells are, and the map stops at the outermost wells instead of guessing beyond them. Copy grid gives the interpolated values, for example to feed another program.

Grid or points?
Your dataLayoutLook
A model or simulation evaluated on a gridGridFilled contours
Spectral map, excitation–emission matrix, image-like dataGridSmooth colour map
Field samples, wells, design-of-experiments runsX, Y, Z columnsFilled contours with the points

Frequently asked questions

How do I make a contour plot from XYZ data?

Choose X, Y, Z columns and paste your three columns. If the points form a complete grid they are used as they are; otherwise they are interpolated by Delaunay triangulation onto a 60 × 60 grid and contoured. Download the PNG or copy the interpolated grid.

How should I lay out a grid in Excel?

X values across the first row (leave the top-left cell empty or put a label in it), Y values down the first column, and each Z value where its row and column meet. Select the whole block, copy, and paste it into the top-left cell.

Contour plot or heat map?

A contour plot (or smooth colour map) shows a continuous surface over two numeric axes. A heat map shows a table of categories, such as genes by samples, with one cell per value. For the second, use the heatmap maker.

How are scattered points interpolated?

By linear interpolation in a Delaunay triangulation, the method of SciPy’s griddata and of most contouring software. It does not invent peaks between points and stops at the outermost points; denser sampling gives a finer map.

Which colour scale should I use?

Viridis or cividis for values with an order, a diverging scale (red–blue, cool–warm) for values above and below zero. Avoid rainbow (jet), which shows bands that are not in the data and fails for colour-blind readers.

Can I set the contour levels?

Set the number of levels under More options; levels fall on round values. For exact levels (for example every 2 units from 50), open the plot in the LabCanvas Graph app.

Put the contour plot in a figure

The LabCanvas Graph app draws contour plots and colour maps with exact levels, insets and journal styles, next to your other graphs. Your data from this page opens in it.

Open the Graph app