Demonstrating an alternative methods-based interface for plotnine.
This is a small Quarto site for Demonstrating an alternative methods-based interface for plotnine (which Codex insists on calling the “fluent” plotnine API). The plotnine used here comes from the codex-fluent-api branch on a fork of the official plotnine.
The basic idea is that from plotnine import * is no longer needed and that + with functions is replaced by method calls. One hope is that this makes plotnine feel more Pythonic. I wrote about the perception that plotnine is “not Pythonic” here.
The notebooks here adapt examples from the plotnine gallery and guide pages, with Polars used where it makes the data prep cleaner.
Gallery Adaptations
Anscombe’s Quartet
Recreates Anscombe’s classic quartet with plotnine, polars, and scikit-learn, including faceted regression lines and a polished final chart.
Please, I Want Some More Labels
Shows how to add titles, subtitles, captions, and legend labels in a fluent plotnine workflow.
A Bar Plot With 2 Variables
Builds a grouped bar chart step by step, using Polars for the data and layer-specific label mappings for the dodged text annotations.
Facets (Subplots)
Demonstrates facet_wrap(), facet_grid(), formula syntax, and free scales in a compact subplot-focused notebook.
Guide Adaptations
Geometric Objects
Condenses the plotnine geoms guide into a notebook covering points, bars, rectangles, lines, ribbons, distributions, position adjustments, and summaries.
Aesthetic Mappings
Focuses on global versus layer-local aes(), literal settings, grouping, and expression-based mappings.
Scales, Legends, and Guides
Covers manual scales, breaks, labels, limits, legend merging, guide placement, and guide customization in the fluent API style.
Source Material
Most notebooks on this site are adapted from the official plotnine gallery and plotnine guides.