pyobsplot

Oct 20, 2023

pyobsplot allows to use Observable Plot to create charts in Jupyter notebooks. Plots are produced as widgets from Python code with a syntax as close as possible to the JavaScript one.

import polars as pl
from pyobsplot import Obsplot, Plot

penguins = pl.read_csv("data/penguins.csv")

Obsplot({
    "grid": True,
    "color": {"legend": True},
    "marks": [
        Plot.dot(
            penguins, 
            {"x": "flipper_length_mm", "y": "body_mass_g", "fill": "species"}
        ),
        Plot.density(
            penguins, 
            {"x": "flipper_length_mm", "y": "body_mass_g", "stroke": "species"}
        )
    ]
})

Observable Plot

↑ up