Giter Site home page Giter Site logo

statworx / statworx-theme Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 6.75 MB

A color theme for matplotlib using the official statworx colors.

Home Page: https://statworx-theme.readthedocs.io/en/latest/?badge=latest

License: MIT License

Shell 0.24% Makefile 1.83% Jupyter Notebook 79.52% Python 18.41%
statworx color-theme matplotlib matplotlib-styles

statworx-theme's Introduction

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)

statworx-theme's People

Contributors

anho4ng avatar b-batton-sw avatar github-actions[bot] avatar

Watchers

 avatar  avatar

statworx-theme's Issues

Incompatible with seaborn 0.12.X

At the end of last year, seaborn 0.12 was released. However, statworx-theme requires (as defined in the pyproject.toml) seaborn <0.12.

Is there a reason for that, or would it be possible to relax that requirement?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.