plotnine-polars

Documentation and examples for plotnine_polars

This site collects examples and guides for the plotnine_polars package.

The focus here is slightly different from the original site:

  • examples use Polars data frames directly
  • plots are built with df.ggplot() where that reads naturally
  • the fluent API comes from plotnine_polars, not from a fork of plotnine

Importing plotnine_polars registers the Polars dataframe namespace:

import polars as pl
import plotnine_polars

df = pl.DataFrame({"x": [1, 2, 3], "y": [3, 2, 1]})

(
    df.ggplot()
    .aes("x", "y")
    .geom_point()
    .geom_line()
)

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 plotnine_polars style.

Source material

Most notebooks on this site are adapted from the official plotnine gallery and plotnine guides.