Gribouille

Create elegant graphics with the Grammar of Graphics for Typst.

Gribouille Gribouille

Create elegant graphics with the Grammar of Graphics for Typst.

Compose charts by layering data, aesthetic mappings, geoms, scales, and themes. The same grammar as ggplot2 and plotnine, drawn natively in Typst.

Get started View on GitHub

Scatter plot of flipper length versus body mass for Adelie, Chinstrap, and Gentoo penguins, with convex hulls, mean and standard deviation error bars, and annotated species cards describing each group.

Scatter plot of flipper length versus body mass for Adelie, Chinstrap, and Gentoo penguins, with convex hulls, mean and standard deviation error bars, and annotated species cards describing each group.

1. Data.

Bring a CSV, a list of dictionaries, or an inline table.

2. Mapping.

Declare which column drives x, y, colour, fill, or size.

3. Layers.

Stack geoms, scales, facets, and a theme until the plot is right.

See it in action

#import "@preview/gribouille:dev": *

#plot(
  data: penguins,
  mapping: aes(
    x: "flipper-len",
    y: "body-mass",
    colour: "species",
    fill: "species",
  ),
  layers: (
    geom-point(size: 2pt, alpha: 0.85),
    geom-smooth(method: "lm", alpha: 0.2),
  ),
  facet: facet-wrap("island", labeller: label-both()),
  scales: (scale-y-continuous(labels: format-comma()),),
  labs: labs(
    title: "Penguin Morphology by Island",
    subtitle: "Flipper length versus body mass with a per-species linear fit",
    x: "Flipper Length (mm)",
    y: "Body Mass (g)",
    colour: "Species",
    fill: "Species",
  ),
  theme: theme-minimal(),
  width: 12cm,
  height: 9cm,
)

Faceted scatter plot of flipper length versus body mass for Adelie, Chinstrap, and Gentoo penguins, split by island, with a linear smoother fitted per species.

Faceted scatter plot of flipper length versus body mass for Adelie, Chinstrap, and Gentoo penguins, split by island, with a linear smoother fitted per species.

What is in the box

Geoms.

Points, lines, bars, histograms, smoothers, ribbons, boxplots, text, labels, and reference lines.

Scales.

Continuous and discrete x, y, colour, fill, size, shape, linetype, with Viridis and manual palettes.

Positions and stats.

Identity, stack, dodge, and fill positions. Bin, count, identity, and smooth stats.

Facets.

facet-wrap and facet-grid with shared or free scales.

Themes.

theme-minimal, theme-classic, theme-void, plus theme() element overrides.

Composable.

Everything is data you can let, extend, and reuse across a Typst document.

A few examples

See all examples

Install.

#import "@preview/gribouille:dev": *

Read the getting-started guide

Gribouille requires Typst 0.14 or later and CeTZ 0.5 as the drawing backend. Released under the MIT Licence.

Back to top