Skip to content

gialdetti/themes

Repository files navigation

themes

themes: style once, plot everywhere

Universal theme styling across the different python visualization libraries. The package also contains out-of-the-box themes (e.g., a financial news theme) for instant use.

Quickstart

import themes
from themes import datasets

themes.register()
markets = datasets.load_markets()
with alt.themes.enable('capon'):
    chart = alt.Chart(markets).mark_line().encode(
        x=alt.X('timestamp', title=None, axis=alt.Axis(format="%b %y")),
        y=alt.Y('relative_price', title="Relative Price", axis=alt.Axis(format='+%')),
        color='symbol',
        tooltip=['timestamp', 'symbol', alt.Tooltip('relative_price', format='+.2%')],
    ).properties(
        title={
            "text": f"Market Indexes Change",
            "subtitle": f"Relative to {markets['timestamp'].dt.date.min()}",
        },

with plt.style.context('capon'):
    markets.pivot_table(index='timestamp', columns='symbol', values='relative_price').plot()

The full example in a live notebook is provided below.

Installing

Install latest release version via pip

$ pip install themes

Install latest development version via pip

pip install git+https://github.com/gialdetti/themes.git

Install latest development version in development mode

git clone git@github.com:gialdetti/themes.git
cd themes
pip install -e .

Help and Support

Examples

All examples are located in examples folder.

Theme MyBinder Colab
Markets Binder Open In Colab

Testing

After installation, you can launch the test suite:

$ pytest