Skip to main content

An Altair theme and chart utility library for publication-ready scientific figures.

Project description

dysonsphere

dysonsphere

dysonsphere is an altair utility library for publication-ready scientific figures in Python, offering:

  • An attractive, cohesive, and sensible default configuration with a single invocation of ds.theme().
  • Perceptually uniform palettes, including those from popular data visualization libraries.
  • Shareable styles through a simple dysonsphere.toml config file - tune the theme once and reuse it across projects.

dysonsphere also comes with several intuitive and powerful utilities for altair charts; some highlights include:

  • The ability to quickly and easily layer altair charts with annotations like reference lines, shades, text, and data labels.
  • Statistical inference with scipy, layered directly onto alt.Chart and conveniently exported as metadata in your saved chart:
    • Omnibus tests with effect sizes.
    • Brackets and p-values for pairwise and post hoc comparisons.
    • Correlations with fit lines.
  • Multilabels that allow for rich annotations of categorical labels, e.g. multi-condition axes and sample sizes.
  • Self-documenting exports for reproducible figures:
    • ds.save() writes a corrected SVG, print-ready PNG, interactive HTML, and/or Vega-Lite JSON, while also embedding the output file with its provenance: environment versions and sha256 checksums identifying both the Vega-Lite spec and the underlying data.
    • ds.read() recovers the statistics report, metadata, and even the original data from a saved figure.
    • ds.load() rebuilds the chart from its JSON.

dysonsphere is extensible with field-specific utilities, allowing domain toolkits (e.g. molecular biology, astronomy) to plug into the same theme, palettes, and export pipeline as separately installed packages.

Installation

# with pip
pip install dysonsphere

# with uv
uv pip install dysonsphere

# add as a project dependency
uv add dysonsphere

Requires Python 3.11+. Every function that takes a DataFrame accepts polars or pandas.

Dependencies:

  • altair>=5.5.0
  • numpy>=1.26.0
  • polars[pyarrow]>=1.19.0
  • scipy>=1.11.0

Quick start

import altair as alt
import polars as pl
import dysonsphere as ds

ds.theme()  # apply the dysonsphere theme to all charts in the session

df = pl.DataFrame({"x": [1.2, 2.4, 3.1, 4.8], "y": [0.9, 2.2, 2.8, 4.4]})

chart = (
    alt.Chart(df)
    .mark_point()
    .encode(
        x="x:Q",
        y="y:Q",
        color=alt.Color("y:Q", scale=alt.Scale(range=ds.palette("blues"))),
    )
)

ds.save(chart, "myplot") # writes myplot.svg + myplot.json

Documentation

Documentation, examples, palettes, and the chart gallery: dkkung.github.io/dysonsphere

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dysonsphere-3.0.0.tar.gz (11.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dysonsphere-3.0.0-py3-none-any.whl (127.8 kB view details)

Uploaded Python 3

File details

Details for the file dysonsphere-3.0.0.tar.gz.

File metadata

  • Download URL: dysonsphere-3.0.0.tar.gz
  • Upload date:
  • Size: 11.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dysonsphere-3.0.0.tar.gz
Algorithm Hash digest
SHA256 a4dd29697411015df1b8c0b445089c774318ff22af2f4c1c6f3b9f19e75d2e0e
MD5 216dd07609e3d65093209d31fdcb98c6
BLAKE2b-256 2ddd15f92eec1d1ab083fd48141c1ddd0ce878e73f63be601e09188f0d836e8f

See more details on using hashes here.

File details

Details for the file dysonsphere-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: dysonsphere-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 127.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dysonsphere-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5275bf9fbab0e5fb9ac7d5beb51d6bed831cebc72387c6840b28d93b2b534bb4
MD5 bac96a6b9cfaab9e2289c843c7fbed66
BLAKE2b-256 89d700a877b23e98d2d83afcf2e1d9dbcc37560f043267931914de676d220072

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page