/altair-stiles

My theme for Python's Altair visualization library

Primary LanguageJupyter NotebookMIT LicenseMIT

The Stiles theme for Altair

Make charts my way using the Altair charting library for Python.

Getting started

Install from PyPI.

$ pip install altair-stiles

Import with Altair.

import altair as alt
import altair_stiles as altstiles

Register and enable the theme.

alt.themes.register('stiles', altstiles.theme)
alt.themes.enable('stiles')

Make a chart.

from vega_datasets import data
source = data.iowa_electricity()

alt.Chart(source, title="Iowa's renewable energy boom").mark_area().encode(
    x=alt.X(
        "year:T",
        title=" "
    ),
    y=alt.Y(
        "net_generation:Q",
        stack="normalize",
        title=" ",
        axis=alt.Axis(format=".0%", tickCount=5),
    ),
    color=alt.Color(
        "source:N",
        legend=alt.Legend(title=" "),
    )
).configure_legend(orient='top')

example

What else?

This library requires that you have the "Roboto" font installed.