Skip to main content

SpiffyPlots

Tests Documentation Status PyPI version GitHub last commit MIT license

A collection of opinionated matplotlib style sheets and plotting tools for publication-ready figures.

Requires Python 3.10 or newer and matplotlib 3.8 or newer.

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

Using the style sheets

Import spiffyplots and load the default spiffy style to get more sensible default plotting parameters across the board.

spiffyplots demo

What does it do?

Life is too short to look at ugly figures. This style fixed that problem for me, and over time I added a bunch of quality-of-life features to it, such as:

  • Editable vector text by default. PDF and PostScript files embed TrueType fonts, and SVG retains <text> elements instead of converting glyphs to paths.
  • Sensible default colors, fonts, and font sizes.
  • Zero outer padding for better control over the final figure size.

Combining style sheets

The base spiffy style contains my own rather opinionated preferences for everyday use. You can combine it with other style sheets to match it to your use case.

import matplotlib.pyplot as plt
import spiffyplots

plt.style.use("spiffy")  # base style only
plt.style.use(["spiffy", "tol-muted"])  # plus a color scheme
plt.style.use(["spiffy", "nature"])  # plus a journal-specific style

What styles are included?

Type Styles
Base spiffy
Color tol-bright, tol-high-contrast, tol-light, tol-medium-contrast, tol-muted, tol-vibrant, okabe-ito
Modifiers latex, latex-helvetica, minor-ticks, right-axis, top-axis
Journals (beta) cell, elife, jmlr, jneurosci, nature, neuron, plos-compbiol, science, tmlr

Why journal-specific style sheets?

Because journal guidelines are oddly specific and differ in some important details (e.g. whether a double-column figure is 175mm or 183mm wide), and I wanted a set-and-forget way of defining the journal style once, so I can focus on the actual data visualization. The API for this might change in future releases.

How to use Journal-specific styles:

Journal styles automatically apply journal guidelines. They set a default figure dimension (double column by default), correct font sizes for all plot elements, and export resolution. Some features, such as different figure size options, can instead be accessed through the spiffyplots.journals module. For example, spiffyplots.journals.nature.single_column(height=65, unit="mm") returns a figure size in inches that matches Nature's single-column figure guidelines with your specified height.

Multi-Panel figures

matplitlib's GridSpec is great, but I got real tired of formatting and re-formatting panel alignments. MultiPanel is my attempt of making this process easier.

import matplotlib.pyplot as plt
from spiffyplots import MultiPanel

plt.style.use("spiffy")

figure = MultiPanel(
    grid=[4, 2],  # 4 panels in the first row, 2 in the second
    labels=True,  # label panels (a, b, c, ...)
)

# Access each subplot axis by its label
figure.panels.a.hist(data)
figure.panels.b.scatter(x1, x2)
(...)

multipanel example

See examples/ex_multipanel.py for the full example and a comparison to the default matplotlib style. There are many other ways to define MultiPanel layouts, label placements, grid arrangements etc, see the example notebook for a short tutorial.

Colors and colormaps

Style sheets only set the default cycle. For easy access to sensible colors, I use spiffyplots.colors for discrete colors and spiffyplots.cmap for colormaps. I really love Paul Tol's color schemes, so I heavily rely on them.

import spiffyplots as spiffy

scheme = spiffy.colors.tol_vibrant
color1 = scheme.red  # '#CC3311'
color2 = scheme.blue  # '#0077BB'

spiffy.colors.from_cmap(spiffy.cmap.sequential, 6)  # 6 equally spaced colors
spiffy.colors.shades(color1, 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.

Colormaps

Again, I wrapped Paul Tol's colormaps together with the default matplotlib colormaps in a convenient way for access & modification:

cmap = spiffy.cmap.sequential  # default sequential colormap (Paul Tol's iridescent)
cmap = spiffy.cmap.diverging  # default diverging colormap (Paul Tol's nightfall)
cmap = spiffy.cmap.iridescent_r  # a specific colormap, reversed
cmap = spiffy.cmap.viridis  # falls through to matplotlib

You can also create colormaps from one or more base colors:

cmap = spiffy.cmap.from_base(color1)  # white -> color -> darker color
cmap = spiffy.cmap.from_colors(spiffy.colors.tol_muted)

Perceptually uniform colormaps

cmcrameri and Colorcet do this exceptionally well, and spiffy.cmap can access their colormaps once either is installed. To install them together with spiffyplots:

pip install "spiffyplots[colormaps]"

You can then access them through spiffy.cmap as well:

import spiffyplots as spiffy

cmap = spiffy.cmap.batlow  # cmcrameri, registered as `cmc.batlow`
cmap = spiffy.cmap.kbc  # colorcet, registered as `cet_kbc`

Credits

  • Most color schemes are Paul Tol's, redistributed under the 3-clause BSD license.

  • Shoutout to cmcrameri and Colorcet for their beautiful perceptually uniform colormaps.

Metadata

Release files for spiffyplots 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spiffyplots 0.8.0
File Size Uploaded Provenance Actions
spiffyplots-0.8.0.tar.gz 559.6 kB With provenance Details for spiffyplots-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spiffyplots 0.8.0
File Interpreter ABI Platform Actions
spiffyplots-0.8.0-py3-none-any.whl Python 3 none any Details for spiffyplots-0.8.0-py3-none-any.whl

Total release size: 606.4 kB

Release files / spiffyplots-0.8.0.tar.gz

Download URL spiffyplots-0.8.0.tar.gz
Size 559.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a597525a9fdac0ed05320a106a8bb806b1d376091e78417a3e737859c7f4f9b5
BLAKE2b-256 checksum
How to use checksums
f01cc8ee8fe84f6ba78713256faabd9f8c053b785b8b648080ed9b9f1b1bc2d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / spiffyplots-0.8.0-py3-none-any.whl

Download URL spiffyplots-0.8.0-py3-none-any.whl
Size 46.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
748301dba6843a50cf16fc9a462ed504b44b302203b9c79ab833e7d493d4dcd8
BLAKE2b-256 checksum
How to use checksums
b34dfb17adc3b0d88240c3c9ca17dff6dbaf9b568a055045658733f1f596726c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Security for spiffyplots 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spiffyplots-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page