Skip to content

anytrellis

Trellis plots for Jupyter and marimo notebooks, drawn on the GPU. A trellis (also called small multiples, or facets) draws the same plot once for each group of a table, on the same scales, so you compare the groups at a glance. anytrellis draws every panel in one canvas, so a grid of hundreds of panels and millions of marks stays smooth to zoom.

The plots on these pages are live: hover over a point, click a plot and scroll to zoom, and drag to pan. Panels that share a scale zoom together.

from anytrellis import Trellis
from anytrellis.datasets import load

gapminder = load("gapminder")
plot = Trellis(gapminder, wrap="year", cols=4, title="Fertility and life expectancy")
plot.points(x="fertility", y="life_expect", color="region", tooltip=["country", "pop"])
plot

What it does

  • Panels from your columns: a wrap of one column's levels (wrap=), or a grid that crosses two (row=, col=) and keeps empty cells so rows and columns line up (tutorial, how to).
  • Scales you can compare: shared by every panel by default, or per row, per column or free; linear or log (tutorial, how to).
  • Layers: lines, points, bars, areas, bands, rects, text and reference rules, and summaries computed per panel: histograms, box plots, densities and smooth fits (how to, distributions).
  • Interaction: zoom and pan linked across panels, box zoom, fit y to the data in view, one panel at a time, full screen (mouse and keys).
  • Selection that reaches Python: brush marks or click a legend entry, and plot.selected() gives the rows; plots linked with link() share one selection (tutorial, how to).
  • Any table: Polars, pandas, PyArrow or a dict of columns (how to).
  • Pages that open anywhere: save_html writes the plot with its data into one HTML file that opens without Python (how to).

Where to start

Install

pip install anytrellis

anytrellis needs Python 3.12 or newer, and runs in JupyterLab, Jupyter Notebook, VS Code and marimo. See Install anytrellis.

The bundled datasets are credited in anytrellis.datasets; the gapminder data is based on free material from GAPMINDER.ORG, CC-BY LICENSE.