Skip to main content

themes: style once, plot everywhere

Project description

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

Libraries and data

import themes
from themes import datasets

themes.register()
markets = datasets.load_markets()

Visualization with matplotlib

import matplotlib.pyplot as plt


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

Visualization with altair

import altair as alt


with alt.themes.enable('capon'):
    display(
        alt.Chart(markets)
        .mark_line(interpolate="monotone")
        .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()}",
            },
            width=600,
            height=200,
        )
    )

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

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

themes-0.0.5.tar.gz (281.9 kB view details)

Uploaded Source

Built Distribution

themes-0.0.5-py3-none-any.whl (279.3 kB view details)

Uploaded Python 3

File details

Details for the file themes-0.0.5.tar.gz.

File metadata

  • Download URL: themes-0.0.5.tar.gz
  • Upload date:
  • Size: 281.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for themes-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7908670996ff000891a05b1b6409755d1a52c020acfea9c1841c3c784e0a3d44
MD5 6c92d03ec1b57bb41d0d052d490ecf26
BLAKE2b-256 fb526306b00926ba80370aad8ce9e1ae3d6b160a7922ae7d93c23feb1213d5f6

See more details on using hashes here.

File details

Details for the file themes-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: themes-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 279.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for themes-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7e7e87566b24105a2c618929807c15a173354252479b8cd49e7087df5dad1d82
MD5 b29f88ffc4a281b98df02a2ed271c860
BLAKE2b-256 380ca0cf0cb47c3ff8109872aa1695451c23984b4e8e099b52d1f4c5b17d365d

See more details on using hashes here.

Supported by

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