Examples

See the examples/ folder for source code.

Image Example

Boing

The Amiga Boing Ball, 1984, animated the way the Amiga animated it: the ball is drawn once as colour indices and spins because the palette is rewritten between frames, while the bounce moves a rigid sprite to whole-pixel positions. Two lookups, so the whole animation is one array with a time axis — built with mp.animation and played as a value rather than a loop. Run it and the palette driving the spin is shown cycling underneath; the gif here is the ball on its own.

Source

Calendar heatmap

Calendar heatmap of daily maximum temperatures in Oxford, 2025.

Source

Colormaps

Gallery of all available continuous and discrete colormaps.

Source

Dashboard

Live system monitoring dashboard showing CPU and memory usage.

Source

Demo

General demonstration combining images, borders, and scatter plots.

Source

Functions

Mathematical function visualisation with scatter and function2.

Source

Game of Life

Conway’s Game of Life, coloured by what just happened to each cell: newborn, stable, or recently dead. The panels underneath track the cell counts and, on the right, what each frame cost to write against what a full redraw would have cost — the two curves separate as the board settles, because a differential redraw costs in proportion to the cells that changed rather than the size of the board.

Source

Hilbert curve

Hilbert curve visualisation of binomial data.

Source

Image rendering

Image rendering with various colormaps.

Source

Joint distribution

Joint distribution with marginal histograms, demonstrating plot composition with hstack and vstack.

Source

Lissajous curves

Brownian motion PCA visualisation with scatterplots and plot arrangement.

Source

Mandelbrot

Animated Mandelbrot fractal zoom using function heatmaps and colormaps.

Source

Quickstart 1

Coloured cosine waves with phase offsets.

Source

Quickstart 2

Animated cosine wave with shifting phase and amplitude, as a loop of print(plot - prev).

Source

Quickstart 3

The same animation with the loop handed to mp.animate, which keeps the previous frame and the frame clock.

Source

Scatter

Spiral scatter plot with viridis colormap.

Source

Teacher-student regression

Gradient descent on a simple teacher-student linear regression model.

Source

Teapot

3D scatter plot with animated camera orbit.

Source

Nothing to show here: a picture of this one running on someone else’s terminal tells you nothing about yours.

Terminal test

Does your terminal render matthewplotlib correctly? Four stages — colour, redrawing in place, resizing, and a plot pushed against the right margin — exercising every escape sequence the library can emit, each saying what it should look like so you can judge it. Measures your terminal’s width and draws to it. See the compatibility page.

Source

Time series histogram

Time series visualisation with stacked scatter, pooled scatter, and 2D histogram.

Source

Voronoi diagram

Voronoi diagram using function heatmaps and scipy.

Source