Skip to main content

ggrust

GitHub License: MIT Docs

The Grammar of Graphics, written in Rust, used from Python.

ggrust is a plotting library with a Lets-Plot compatible Python API. Plots are built the familiar ggplot way, layer by layer with +, while the stats, scales, layout and rendering all run in Rust.

It was started for Cellestial, which needed a maintained backend for its Lets-Plot based API. For most code, switching is an import swap: lets_plot -> ggrust.

Data crosses into Rust once, as Arrow, so Polars and pandas frames work directly.

Installation

pip install ggrust
uv add ggrust

Quickstart

import polars as pl
from ggrust import *

frame = pl.DataFrame(
    {
        "height": [150, 162, 171, 180, 168, 175],
        "weight": [52, 60, 68, 82, 65, 74],
        "group": ["a", "a", "b", "b", "c", "c"],
    }
)

plot = (
    ggplot(frame, aes(x="height", y="weight", color="group"))
    + geom_point(size=4)
    + labs(title="Height vs weight")
    + ggsize(600, 400)
)

plot.to_png("plot.png")

Scatter plot coloured by group

In a notebook the plot shows as interactive HTML (tooltips, zoom and pan with ggtb()).

Examples

Distributions

Violins with boxplots on top, using the same layering as ggplot.

Show code
import numpy as np

rng = np.random.default_rng(0)
days = ["Mon", "Tue", "Wed", "Thu", "Fri"]
commute = pl.DataFrame(
    {
        "day": np.repeat(days, 200),
        "minutes": np.concatenate([rng.gamma(4 + i, 6, 200) for i in range(5)]),
    }
)

(
    ggplot(commute, aes(x="day", y="minutes", fill="day"))
    + geom_violin(alpha=0.6)
    + geom_boxplot(width=0.15, fill="white")
    + labs(title="Commute time by weekday")
    + theme_classic()
    + ggsize(600, 400)
)

Violin and boxplot of commute times

Facets

Split a plot into panels by a column.

Show code
months = np.arange(1, 13)
temperature = pl.DataFrame(
    {
        "month": np.tile(months, 3),
        "temp": np.concatenate(
            [10 + 8 * np.sin((months - 3) / 12 * 2 * np.pi) + offset for offset in (0, 5, -4)]
        ),
        "city": np.repeat(["Lisbon", "Athens", "Oslo"], 12),
    }
)

(
    ggplot(temperature, aes(x="month", y="temp", color="city"))
    + geom_line(size=1.2)
    + geom_point()
    + facet_wrap("city", ncol=3)
    + labs(title="Monthly temperature", y="°C")
    + theme_bw()
    + ggsize(900, 350)
)

Monthly temperature faceted by city

What it covers

  • Geoms: point, line, path, bar, histogram, boxplot, violin, area ridges, tile, raster, rect, text, label, text/label repel, segment, polygon, imshow, brackets and more.
  • Scales: continuous, discrete, log, reversed, hue, manual, gradients, viridis, brewer.
  • Layout: facet_wrap, gggrid with collected legends, coord_fixed, coord_flip, themes (theme_classic, theme_bw, theme_void).
  • Outputs: SVG, PNG, PDF, and HTML through ggsave. Dense scatter layers are drawn on a canvas in HTML.

ggrust is a subset of Lets-Plot, not all of it. Features follow what Cellestial and everyday plotting need. See the migration note for the differences.

Performance

Compared with Lets-Plot on identical work: same data, every row drawn (Lets-Plot sampling turned off), same output size. Measured on an Apple M4 Pro, ggrust 0.1.0 vs lets-plot 4.11.0.

  • Speed: SVG a median 40x faster (5x to 185x over 23 cases), PNG a median 22x faster (13x to 119x).
  • Memory: a median 14x lower peak memory (3.6x to 220x). A 1M-point scatter PNG peaks at 44 MB above the data in ggrust and 9.6 GB in Lets-Plot.
  • No case was slower. The weakest spots are point-heavy PNGs (13x to 21x) and large SVGs, where ggrust still peaks at 430 MB for 1M points.

Speed-up over Lets-Plot per case Peak memory ratio over Lets-Plot per case

Full methodology, raw numbers and side-by-side output images are in the benchmark report.

Status

Early, but usable: the full Cellestial test suite passes on ggrust. Expect rough edges and API gaps; issues are welcome.

Development

uv sync          # create the dev environment
make develop     # build the Rust extension into .venv
make check       # fmt, clippy, ruff, cargo test, pytest

Roadmap in plan.md, contributor rules in AGENTS.md.

Metadata

Release files for ggrust 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ggrust 0.1.0
File Size Uploaded Provenance Actions
ggrust-0.1.0.tar.gz 2.1 MB With provenance Details for ggrust-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ggrust 0.1.0
File Actions
ggrust-0.1.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for ggrust-0.1.0-cp311-abi3-win_arm64.whl
ggrust-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for ggrust-0.1.0-cp311-abi3-win_amd64.whl
ggrust-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for ggrust-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
ggrust-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for ggrust-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
ggrust-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for ggrust-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
ggrust-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for ggrust-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 44.2 MB

Release files / ggrust-0.1.0.tar.gz

Download URL ggrust-0.1.0.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
254b11caa3000c0695c1efdb66ebbc784239d256cff8f296358e157702ca41a3
BLAKE2b-256 checksum
How to use checksums
d708bdecf79260875dd2fd4357d5e5cd378d31c0b968e01ceb4c9bc224a72eba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-win_arm64.whl

Download URL ggrust-0.1.0-cp311-abi3-win_arm64.whl
Size 6.7 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
98581d4c95af323efe6c8268eb925cc5b5529089abd7ca8f991730909c308a2f
BLAKE2b-256 checksum
How to use checksums
96c5ac5ecfeef9eb7e172c72dd628d96a20d515fd03b38bf80acc4a88357526d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-win_amd64.whl

Download URL ggrust-0.1.0-cp311-abi3-win_amd64.whl
Size 7.3 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ce655ad0eb861fdde62b4d9149f810a45447419e25c4b8499d7999a9cb189780
BLAKE2b-256 checksum
How to use checksums
91120f6f8ffe4daef4ac5bac9009a709ad5ff609c67ae553003830eb69ba477d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL ggrust-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 7.3 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
826db5b1ab5867f23fd066468f7aa3763630a62e05caf04c218b6e18ba06769f
BLAKE2b-256 checksum
How to use checksums
e2544fe1d6d2b536437065f08961ad07b1b0bdb0eb02ecebde36b129a0af4b8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL ggrust-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 7.0 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
6aeb2feb42ff9d469ae0fb8613abbbfe8639294ecab32bbba26105bde35dfbc2
BLAKE2b-256 checksum
How to use checksums
27307029ece0f9a8a0a2098b0ebe6e4425382e57d3f8ff65a11b2488775978ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL ggrust-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 6.7 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6107f233ada127f526523591949df8a279e6502a7ccc5f9aa7dfca89082db7ab
BLAKE2b-256 checksum
How to use checksums
ad0238533cf0469a8dff4100ca405af0a41877ee0770e93246931acd206e20e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / ggrust-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL ggrust-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 7.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7f69dcaf1f4c7a50d5ef8109296697216e6443bd71afcd7901f41f5f151cb7bd
BLAKE2b-256 checksum
How to use checksums
503785b6b160233685850ba9d606416f30f79c1cc312b4503a5694cee3cd398e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for ggrust 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for ggrust-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

7 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page