Skip to main content

A color theme for matplotlib using the offical statworx design

Project description

Statworx Theme

PyPI version Documentation Status Release Code Quality Python version License: MIT pre-commit

A color theme plugin for the matplotlib library and all its derivatives, as well as an optional adaption of this theme for altair and plotly, which automatically applies the official statworx color theme. This package also registers commonly used qualitative color maps (such as a fade from good to bad) for use in presentations.

Sample

Quick Start

Simply install a module with pip by using the following command.

pip install statworx-theme

For usage of altair and plotly extra dependencies need to be installed using pip.

pip install "statworx-theme[altair]"
pip install "statworx-theme[plotly]"

For using the styles inside a poetry managed project use poetry add with extras.

#only matplotlib
poetry add statworx-theme

# altair theme
poetry add statworx-theme -E "altair"

# plotly theme
poetry add statworx-theme -E "plotly"

# Whole package
poetry add statworx-theme -E "altair plotly"

To apply the matplotlib style, you must call the apply_style function by typing:

from statworx_theme import apply_style
apply_style()

For applying the plotly or altair style the respective apply_style_<library> function is used:

from statworx_theme import apply_style_altair, apply_style_plotly
apply_style_altair()
apply_style_plotly()

Gallery

Matplotlib

There is an extensive gallery of figures that use the Statworx theme that you can draw inspiration from. You can find it here. For a figure gallery using the altair and plotly theme see the respective notebooks inside the repository.

Sample

Custom Colors

You can also use a custom list of color for the color scheme beside the official statworx colors. There is a convenience function for that which is described below. This simply changes the colors.

Matplotlib

In case you want to change the entire style you should implement your own .mplstyle file (see this).

from statworx_theme import apply_custom_colors

custom_colors = [
    DARK_BLUE := "#0A526B",
    DARK_RED := "#6B0020",
    GREY := "#808285",
]
apply_custom_colors(custom_colors)

Altair

from statworx_theme import apply_custom_colors_altair

custom_colors = [
    DARK_BLUE := "#0A526B",
    DARK_RED := "#6B0020",
    GREY := "#808285",
]
apply_custom_colors_altair(category=custom_colors)

Plotly

from statworx_theme import apply_custom_colors_plotly
custom_colors = [
    DARK_BLUE := "#0A526B",
    DARK_RED := "#6B0020",
    GREY := "#808285",
]
apply_custom_colors_plotly(category=custom_colors)

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

statworx_theme-2.0.2.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

statworx_theme-2.0.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file statworx_theme-2.0.2.tar.gz.

File metadata

  • Download URL: statworx_theme-2.0.2.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for statworx_theme-2.0.2.tar.gz
Algorithm Hash digest
SHA256 f27de266bd1d7b899da02a9bb03cf179b71d7fa33869f61179c8d6ecc3671865
MD5 3cbb7becded97ab99dbbee3133af68b9
BLAKE2b-256 d0fd3fb9d89efd08d8f3ad0df322f00e5c16a33ac28c6c0089e40c8ebba801fa

See more details on using hashes here.

File details

Details for the file statworx_theme-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: statworx_theme-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for statworx_theme-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92a2e4599b84d21a2a0d0b11a0708c0ad364ac277af6991c5d63ec406c390a26
MD5 193a3ee726ae855ea320c3a62ddeacc7
BLAKE2b-256 2bb0f4e17cbea6ae7a8ad5646c922a5e989e2d4f52cba49f64b9c661e491f546

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