Examplesdocs

Do you have a cool, standalone matthewplotlib example?

I'd love to include it on this page! Please send me a link.

Contents:

See the examples/ folder for source code.

Point Data Visualisationdocs

Image Example

Line charts

Line plot test, including series with missing values (NaN).

By Claude Opus 5.

Source

Lissajous curves

Brownian motion PCA visualisation with scatterplots and plot arrangement.

By Matthew Farrugia-Roberts.

Source

Quickstart 1

Coloured cosine waves with phase offsets.

By Matthew Farrugia-Roberts.

Source

Quickstart 2

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

By Matthew Farrugia-Roberts.

Source

Quickstart 3

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

By Claude Opus 5.

Source

Scatter

Spiral scatter plot with viridis colormap.

By Matthew Farrugia-Roberts.

Source

Starburst

Line plot colour and thickness test.

By Claude Opus 5.

Source

Teacher-student regression

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

By Matthew Farrugia-Roberts.

Source

Surface Data Visualisationdocs

Image Example

Chromatic flow

A moving incompressible velocity field, with hue showing direction and brightness showing speed. Its custom colormap consumes two-component vectors directly.

By GPT 5.6 Sol.

Source

Domain colouring

Six complex functions. Hue for phase and lightness for modulus. Zeros come out black and poles white. A dark ring marks every doubling.

By Claude Opus 5.

Source

Functions

Mathematical function visualisation with scatter and function2.

By Matthew Farrugia-Roberts.

Source

Phase portraits

Six planar vector fields as colour fields. Hue for direction and brightness for magnitude.

By Claude Opus 5.

Source

Time series histogram

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

By Matthew Farrugia-Roberts.

Source

Voronoi diagram

Voronoi diagram using function heatmaps and scipy.

By Gemini 2.5 Pro.

Source

Bars and Columnsdocs

Image Example

Joint distribution

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

By Claude Opus 4.6.

Source

Sorting algorithms

Various sorting algorithms racing in parallel, visualised with mp.columns and mp.wrap.

By Gemini 3.1 Pro.

Source

Boxes and Candlesdocs

Image Example

Box plots

Four distributions with the same quartiles and different shapes.

By Claude Opus 5.

Source

Candlesticks

A simulated price series.

By Claude Opus 5.

Source

Nonlinear Visualisationdocs

Image Example

Calendar heatmap

Calendar heatmap of daily maximum temperatures in Oxford, 2025.

By Matthew Farrugia-Roberts and Claude Opus 4.6.

Source

Commit heatmap

A year of commits to this repository as a strip of weeks.

By Claude Opus 5.

Source

Hilbert curve

Hilbert curve visualisation of binomial data.

By Matthew Farrugia-Roberts.

Source

Mediadocs

Image Example

Image rendering

Image rendering with various colormaps.

By Matthew Farrugia-Roberts.

Source

Mapsdocs

Image Example

Globe

A spinning Earth based on projection inversion. Terrain, clouds, city lights, day-night, atmospheric halo.

By Claude Opus 5.

Source

Great-circle routes

Ten long-haul flight routes on a world map. Try one of five different projections!

By Claude Opus 5.

Source

Retro Animationsdocs

Image Example

Boing

The Amiga Boing Ball, 1984, animated using a rotating colour palette.

By Claude Opus 5.

Source

Doom fire

The classic 1997 PSX Doom fire effect mapped through a custom palette using mp.image.

By Gemini 3.1 Pro.

Source

Teapot

3D scatter plot with animated camera orbit.

By Matthew Farrugia-Roberts.

Source

Vaporwave

A wireframe landscape scrolling under a banded sun. The backdrop of sky, ground and sun is an image of half-blocks; the terrain is one mp.line3 over the top of it.

By Matthew Farrugia-Roberts and Claude Opus 5.

Source

Simulationsdocs

Image Example

Boids

Boids Flocking Simulation. Simulates autonomous agents (boids) moving in 2D space based on simple rules.

By Gemini 3.1 Pro.

Source

Life

Conway's Game of Life with extra colours for newly alive/dead cells. The panels underneath track the cell counts and, on the right, number of terminal bytes written using different rendering methods.

By Claude Opus 5.

Source

Lorenz attractor

Animated 3D Lorenz attractors showing sensitive dependence on initial conditions.

By Gemini 3.1 Pro.

Source

Mandelbrot

Animated Mandelbrot fractal zoom using function heatmaps and colormaps.

By Gemini 2.5 Pro.

Source

Three bodies

Three equal masses chasing one another around a shared figure-eight orbit, integrated under Newtonian gravity.

By GPT 5.6 Sol.

Source

Dashboards and UIdocs

Image Example

Dashboard

Live system monitoring dashboard showing CPU and memory usage.

By Gemini 2.5 Pro.

Source

Sweep report

A hyperparameter sweep reported in tables: runs ruled the way a paper rules a table, the sweep itself shaded by the losses it is showing, and a legend whose rows are coloured to match the curves beside them.

By Claude Opus 5.

Source

Utilitiesdocs

Image Example

Axes gallery

Axis configuration options: Side types, rule types.

By Claude Opus 5.

Source

Colorbars

An island's elevation with its scale beside it, then the same scale in four directions and four thicknesses.

By Claude Opus 5.

Source

Colormaps

Gallery of all available continuous and discrete colormaps.

By Matthew Farrugia-Roberts.

Source

Demo

Original library example combining images, borders, and scatter plots.

By Matthew Farrugia-Roberts.

Source

Run python examples/terminal_test.py

Terminal test

Does your terminal render matthewplotlib correctly? Test of escape sequences for colour, redrawing in place, resizing, and a plot pushed against the right margin.

See also compatibility.

By Claude Opus 5.

Source