plotstyle

Publication-ready scientific figures: one line of code.

PyPI Python License Docs


PlotStyle is a Python library for researchers who use Matplotlib to produce figures for academic publication. It encodes the formatting requirements of major scientific journals into preset configurations: font families, column widths, line weights, DPI, color accessibility rules, and export formats. You apply them with a single call.

import plotstyle

with plotstyle.use("nature") as style:
    fig, ax = style.figure(columns=1)
    ax.plot([0, 1, 2], [0.2, 0.8, 0.4])
    style.savefig(fig, "figure1.pdf")

The context manager sets Matplotlib’s rcParams for the duration of the block and restores them on exit. Everything produced inside - figures, colors, exports - conforms to the journal’s guidelines automatically.


Who it is for

PlotStyle is designed for:

  • Researchers preparing figures for peer-reviewed journal submission

  • Lab groups that want a consistent, reproducible styling workflow

  • Anyone who needs clean Matplotlib figures without manual rcParams configuration

It works as a thin, unopinionated wrapper around Matplotlib and is compatible with Seaborn.


Key capabilities

Journal presets

plotstyle.use("nature") applies the full style configuration for the selected journal: fonts, figure widths, minimum line weights, DPI, and export requirements. Settings are scoped to the context block and do not persist into the rest of your session.

Correct figure dimensions

style.figure(columns=1) and style.subplots(nrows, ncols, columns=2) produce figures at the exact column width the journal specifies, in millimeters, converted to the right unit for Matplotlib. Multi-panel figures automatically receive panel labels (a, b, c) formatted according to the journal’s own style.

Overlays

Overlays are additive patches that extend or override journal settings. Stack them in any order:

with plotstyle.use(["nature", "okabe-ito", "notebook"]) as style:
    ...

Overlays are organized into five categories:

Category

Examples

Color

okabe-ito, tol-bright, tol-high-contrast, safe-grayscale

Context

notebook, presentation, minimal, high-vis

Rendering

no-latex, latex-sans, grid, pgf

Script

cjk-simplified, cjk-japanese, russian, turkish

Plot type

bar, scatter

You can also use overlays without a journal preset, for example to style notebook figures or slide graphics.

Colorblind-safe palettes

style.palette(n=4) returns colors from the journal’s recommended palette. Built-in palettes include Okabe-Ito, several Tol variants, and a grayscale-safe set. Pass with_markers=True to get (color, linestyle, marker) tuples for journals that require grayscale compatibility.

Accessibility previews

plotstyle.preview_colorblind(fig) renders your figure under three types of color vision deficiency (deuteranopia, protanopia, tritanopia). plotstyle.preview_grayscale(fig) shows a luminance-based grayscale version. Use these before submitting.

Pre-submission validation

style.validate(fig) checks your figure against the journal’s requirements: dimensions, font sizes, line weights, color accessibility, and export settings. It returns a structured report with pass, warn, and fail states, and suggested fixes for each issue.

Export for submission

style.savefig(fig, "figure1.pdf") enforces TrueType font embedding and the journal’s minimum DPI. style.export_submission(fig, "fig1", output_dir="submission/") saves in all formats the journal accepts in one call. IEEE submissions can include an author surname prefix automatically.

Spec comparison and figure migration

plotstyle.diff("nature", "science") shows every requirement that differs between two journals. plotstyle.migrate(fig, from_journal="nature", to_journal="science") resizes and re-styles an existing figure for the target journal, with proportional text rescaling.

Seaborn compatibility

plotstyle.patch_seaborn() monkey-patches sns.set_theme() so it no longer overwrites PlotStyle’s rcParams. Call plotstyle.unpatch_seaborn() to restore the original behavior.

CLI

Discover presets, check fonts, and validate files without writing Python:

plotstyle list                   # all supported journals
plotstyle info nature            # Nature's full spec
plotstyle diff nature science    # compare two journals
plotstyle fonts --journal ieee   # check font availability
plotstyle overlays --category color
plotstyle validate figure1.pdf --journal nature   # check font embedding

Supported journals

Key

Journal

Publisher

acm

ACM

ACM

acs

ACS (JACS)

American Chemical Society

cell

Cell

Cell Press

elsevier

Elsevier

Elsevier

ieee

IEEE Transactions

IEEE

nature

Nature

Springer Nature

plos

PLOS ONE

Public Library of Science

prl

Physical Review Letters

American Physical Society

science

Science

AAAS

springer

Springer

Springer

usenix

USENIX

USENIX Association

wiley

Wiley

Wiley


Where to start

New to PlotStyle? Follow this path:

  1. Installation: install the package and optional dependencies

  2. Quickstart: create your first journal figure in five minutes

  3. Concepts: understand how presets, overlays, and context managers work together

For the complete function reference, see the API reference. For per-journal details and formatting requirements, see Journals.