# Contour plot and 2D colour map maker

> Paste a grid or scattered X, Y, Z points and get a filled contour plot or smooth 2D colour map with labelled levels and a colour bar. Free, no sign-up.

URL: https://www.labcanvas.com/tools/contour-plot-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.

## Quick answer

- **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:** Scattered points: Delaunay triangles, then linear (barycentric) interpolation z = λ₁z₁ + λ₂z₂ + λ₃z₃ on a 60 × 60 grid; levels at round steps (about 10).
- **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.

Free, in the browser, no account needed. Updated 2026-11-17.

## Features

- Grid (matrix) input: X across the top, Y down the side, Z in the cells; unevenly spaced X and Y are fine
- Scattered X, Y, Z points: Delaunay triangulation and linear interpolation (as SciPy’s griddata), clipped to the points’ hull, with the points shown
- Filled contours with labelled contour lines, or a smooth colour map (spectral maps, excitation–emission matrices)
- Perceptually uniform colour scales (viridis, cividis, magma, inferno, plasma) and diverging ones centred on zero
- About n levels at round values (Matplotlib’s rule), a log colour scale for positive data, reversed colours
- Copy or download the grid that is drawn (the interpolated values for scattered points)
- PNG at 300 or 600 dpi; opens in the LabCanvas Graph app as an editable contour graph; nothing is uploaded

## How to use it

1. **Choose the layout**: A 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 values**: Click 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 export**: Filled 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.

## At a glance

| | |
| --- | --- |
| Input | A grid (X across the top, Y down the side, Z in the cells) or X, Y, Z columns |
| Interpolation | Delaunay triangulation, linear, onto a 60 × 60 grid, clipped to the hull |
| Drawing | Filled contours with labelled lines or a smooth colour map, colour bar |
| Accuracy | Interpolation matches SciPy griddata to 10⁻⁹; levels equal Matplotlib’s |
| Export | PNG at 300 or 600 dpi, CSV of the grid; editable 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 = \lambda_1 z_1 + \lambda_2 z_2 + \lambda_3 z_3, \qquad \lambda_1 + \lambda_2 + \lambda_3 = 1$$

where \(\lambda_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](https://doi.org/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](https://doi.org/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.

| Time \ Temperature | 40 | 45 | 50 | … |
| --- | --- | --- | --- | --- |
| 10 | 55.5 | 59.4 | 62.9 | … |
| 20 | 58.5 | 62.3 | 65.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.

| Your data | Layout | Look |
| --- | --- | --- |
| A model or simulation evaluated on a grid | Grid | Filled contours |
| Spectral map, excitation–emission matrix, image-like data | Grid | Smooth colour map |
| Field samples, wells, design-of-experiments runs | X, Y, Z columns | Filled contours with the points |



## 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.
