Quick start

Enable the WBG theme once, then pass summarized data to an opinionated chart factory.

import attaviz
import pandas as pd

attaviz.enable()

source = pd.DataFrame(
    {
        "site": ["Crookston", "Duluth", "Grand Rapids", "Morris", "University Farm"],
        "yield": [35.1, 33.0, 24.9, 35.4, 32.7],
    }
)

attaviz.bar(
    source,
    category="site",
    value="yield",
    title="Barley yield by site",
    subtitle="Mean yield across varieties and years",
)

Factories handle recurring editorial choices such as sorting, labels, tooltips, highlighting, number formatting, and responsive width. They return ordinary Altair charts, so normal Altair customization remains available.

chart = attaviz.bar(
    source,
    category="site",
    value="yield",
    highlight="Morris",
)

chart = attaviz.frame(
    chart,
    description="Horizontal bars comparing mean barley yield at six sites.",
    source="Minnesota agricultural experiment stations",
)

Size variants

Three typography/spacing presets are available. Pick the one that matches the intended display width.

attaviz.enable(size="small")   # charts under ~400px wide
attaviz.enable(size="medium")  # 400–700px (default)
attaviz.enable(size="large")   # wider than 700px

Per-chart sizing

To size a single chart without switching the global theme:

chart = attaviz.configure_size(chart, width=600, aspect_ratio="16:9")

Next, read the chart factory reference, map reference, or browse the gallery.