Skip to content
dysonsphere

dysonsphere

Publication-ready Altair charts. Perceptually uniform palettes, statistical annotations, and exports that carry their own provenance.
Terminal window
pip install dysonsphere
import altair as alt
import numpy as np
import polars as pl
import dysonsphere as ds
ds.theme(palette="blues2", chartWidth=140)
rng = np.random.default_rng(7)
rep1 = rng.normal(10, 2, 2500)
df = pl.DataFrame({"rep1": rep1, "rep2": rep1 * 0.9 + rng.normal(1, 0.9, 2500)})
heatmap = (
alt.Chart(df)
.mark_rect()
.encode(
x=alt.X("rep1:Q", bin=alt.Bin(maxbins=24), title="Replicate 1"),
y=alt.Y("rep2:Q", bin=alt.Bin(maxbins=24), title="Replicate 2"),
color=alt.Color("count():Q", title=None),
)
)
chart = heatmap + ds.add_correlation(df, "rep1", "rep2")

Publication defaults

Charts are authored at print scale with considered typography, tick geometry, and mark styling - the SVG that comes out is the figure that goes in the paper.

Perceptually uniform palettes

300+ palettes built in Oklab and resampled by arc length, so sequential ramps step evenly and diverging ramps balance. Exportable straight to Illustrator swatches.

Statistical annotations

Omnibus tests, post-hoc brackets, correlation readouts - computed with scipy, drawn as layers you compose with +, reported with exact p-values and effect sizes.

Composable marks & layers

Violins, strip plots, reference lines, text, shading, point labels, multilabels, log/power minor ticks - all native Altair objects that layer onto your own charts.

Self-describing exports

save() embeds provenance, statistics, the theme, and your data into SVG, PNG, and JSON; read() and load() pull them back out. Every figure is its own lab notebook entry.

Runs in your browser

The Chart Studio runs the real library via WebAssembly - upload your own data or write Python against it, no install, same output as your notebook.