Observable Plot in Python
See the codepyobsplot allows to use Observable Plot to create charts in Jupyter or Marimo notebooks and Quarto documents. Plots are created from Python code with a syntax as close as possible to the JavaScript one.
It allows to do things like :
import polars as pl
from pyobsplot import Plot
penguins = pl.read_csv("https://github.com/juba/pyobsplot/raw/main/doc/data/penguins.csv")
Plot.plot({
"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"}
)
]
})

pyobsplot can be installed with uv or pip:
# uv
uv add pyobsplot[typst]
# pip
pip install pyobsplot[typst]
To use pyobsplot in JupyterLite or marimo you must install it without the typst dependency, which is not yet compatible with pyodide:
pip install pyobsplot
For usage instructions, see the documentation website:
If you just want to try this package without installing it on your computer, you can open an introduction notebook in Google Colab:
Features:
js methoddate and datetime objects are automatically converted to JavaScript Date objectsLimitations:
jsdom renderer has been adapted from altair_saver.731 commits
1 commits
HTML
96.6%
Python
2.8%
Observable Plot in Python
See the codepyobsplot allows to use Observable Plot to create charts in Jupyter or Marimo notebooks and Quarto documents. Plots are created from Python code with a syntax as close as possible to the JavaScript one.
It allows to do things like :
import polars as pl
from pyobsplot import Plot
penguins = pl.read_csv("https://github.com/juba/pyobsplot/raw/main/doc/data/penguins.csv")
Plot.plot({
"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"}
)
]
})

pyobsplot can be installed with uv or pip:
# uv
uv add pyobsplot[typst]
# pip
pip install pyobsplot[typst]
To use pyobsplot in JupyterLite or marimo you must install it without the typst dependency, which is not yet compatible with pyodide:
pip install pyobsplot
For usage instructions, see the documentation website:
If you just want to try this package without installing it on your computer, you can open an introduction notebook in Google Colab:
Features:
js methoddate and datetime objects are automatically converted to JavaScript Date objectsLimitations:
jsdom renderer has been adapted from altair_saver.731 commits
1 commits
HTML
96.6%
Python
2.8%