SpiffyPlots
A collection of matplotlib style sheets and plotting tools for publication-ready figures.
Requires Python 3.10 or newer and Matplotlib 3.8 or newer.
- Free software: MIT license
- Documentation: https://spiffyplots.readthedocs.io.
Simple style example:
Installation
Install the latest release:
pip install spiffyplots
or install the latest commit directly from GitHub:
pip install git+https://github.com/JRBCH/spiffyplots.git
For local development, install uv and run:
uv sync
uv run ruff check .
uv run pytest
Using the style sheets
The style sheets ship inside the package and register themselves with
matplotlib when spiffyplots is imported:
import spiffyplots # registers the styles and colormaps
import matplotlib.pyplot as plt
plt.style.use("spiffy") # base style
plt.style.use(["spiffy", "tol-muted"]) # base style plus a color scheme
Import spiffyplots before calling plt.style.use. The base style names a
colormap that this package registers, and a style sheet naming an unregistered
colormap applies silently and then fails at draw time.
Available styles:
| base | spiffy |
| color | tol-bright, tol-high-contrast, tol-light, tol-medium-contrast, tol-muted, tol-vibrant, okabe-ito |
| modifiers | latex, minor-ticks, right-axis, top-axis |
The base spiffy style keeps vector text editable. PDF
and PostScript embeds TrueType fonts, and SVG retains <text> elements instead of converting glyphs to paths.
If for some reason you want to restore
Matplotlib's default outlined SVG behavior, set plt.rcParams["svg.fonttype"] = "path".
Colors and colormaps
Style sheets only set the default cycle. For the colors themselves, use
spiffyplots.colors for discrete colors and spiffyplots.cmap for colormaps.
import spiffyplots as spiffy
scheme = spiffy.colors.tol_vibrant
color_exc = scheme.red # '#CC3311'
color_inh = scheme.blue # '#0077BB'
spiffy.colors.from_cmap(spiffy.cmap.sequential, 6) # 6 equally spaced colors
spiffy.colors.shades(color_exc, 5) # 5 shades of one base color
Schemes: tol_bright, tol_high_contrast, tol_vibrant, tol_muted,
tol_medium_contrast, tol_light, tol_pale, tol_dark and okabe_ito.
Each is a tuple you can index, slice and iterate, whose colors are also
reachable by name. Each runs in its author's recommended order, then black,
then grey.
cmap = spiffy.cmap.sequential # Paul Tol's iridescent
cmap = spiffy.cmap.diverging # Paul Tol's nightfall
cmap = spiffy.cmap.iridescent_r # any of Tol's, by short name
cmap = spiffy.cmap.viridis # falls through to matplotlib
cmap = spiffy.cmap.batlow # falls through to cmcrameri
cmap = spiffy.cmap.kbc # falls through to colorcet
cmap = spiffy.cmap.from_base(color_exc) # white -> color -> darker
cmap = spiffy.cmap.from_colors(spiffy.colors.tol_muted)
cmap = spiffy.cmap.discrete_rainbow(8)
Perceptually uniform colormaps
cmcrameri and
colorcet do that very well, and
spiffy.cmap reaches their colormaps too once either is installed.
To install them together with spiffyplots:
pip install "spiffyplots[colormaps]"
import spiffyplots as spiffy
cmap = spiffy.cmap.batlow # cmcrameri, registered as `cmc.batlow`
cmap = spiffy.cmap.kbc # colorcet, registered as `cet_kbc`
-
Matplotlib style sheets
- General style sheets for quick and beautiful out-of-the-box plotting
- Color style sheets for Paul Tol's color schemes and Okabe-Ito, all color-blind safe
-
Colors
- Easy access to colors and colormaps
- Ramps and shades derived from one base color, e.g. for heatmaps
-
Multi-panel figures
- Easy and flexible wrapper of matplotlib's GridSpec
- Automatic labelling of sub-panels
- Support for custom panel arrangements and labels
- Figure sizes in inches, centimetres or millimetres
Credits
-
This package was created with Cookiecutter and the
audreyr/cookiecutter-pypackageproject template. -
Most color schemes are Paul Tol's, redistributed under the 3-clause BSD license
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spiffyplots-0.7.0.tar.gz.
File metadata
- Download URL: spiffyplots-0.7.0.tar.gz
- Upload date:
- Size: 830.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d595c492bdee4b2027c63b9ce771803d5e64709f83cd4e0c7b0427d15c7c5c
|
|
| MD5 |
3dc013ac6c5f8f882d4ea3b904d8f345
|
|
| BLAKE2b-256 |
d51562a2dbcdf65bd0a3c00c2235de6ef1baf72762c634b6f929508256770b64
|
Provenance
The following attestation bundles were made for spiffyplots-0.7.0.tar.gz:
Publisher:
publish.yaml on JRBCH/spiffyplots
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiffyplots-0.7.0.tar.gz -
Subject digest:
b9d595c492bdee4b2027c63b9ce771803d5e64709f83cd4e0c7b0427d15c7c5c - Sigstore transparency entry: 2359881959
- Sigstore integration time:
-
Permalink:
JRBCH/spiffyplots@6c8f6ec4d7a541aa0fa16ac0ed050ccdc858ffdc -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/JRBCH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6c8f6ec4d7a541aa0fa16ac0ed050ccdc858ffdc -
Trigger Event:
push
-
Statement type:
File details
Details for the file spiffyplots-0.7.0-py3-none-any.whl.
File metadata
- Download URL: spiffyplots-0.7.0-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b72f822cd4b8f33665b89a43b6fb616e0d17bd026260e21b1ce54791983e4431
|
|
| MD5 |
61e27789c9d867fd6e0e6dbf945ca644
|
|
| BLAKE2b-256 |
dcb5824beabdfdbbd7a9012324c1f183b01a9b4deb219e206f0e7b203a378e84
|
Provenance
The following attestation bundles were made for spiffyplots-0.7.0-py3-none-any.whl:
Publisher:
publish.yaml on JRBCH/spiffyplots
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spiffyplots-0.7.0-py3-none-any.whl -
Subject digest:
b72f822cd4b8f33665b89a43b6fb616e0d17bd026260e21b1ce54791983e4431 - Sigstore transparency entry: 2359882290
- Sigstore integration time:
-
Permalink:
JRBCH/spiffyplots@6c8f6ec4d7a541aa0fa16ac0ed050ccdc858ffdc -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/JRBCH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@6c8f6ec4d7a541aa0fa16ac0ed050ccdc858ffdc -
Trigger Event:
push
-
Statement type: