Skip to main content

proteus-mpl

PROTEUS Thermocline matplotlib theme. Publication-grade figures whose colors, fonts, and surfaces match the slides, the website, and the docs.

Install

pip install proteus-mpl

From a checkout of the repository: pip install figures/proteus-mpl (or cd into the folder and pip install .).

Use

import proteus_mpl
proteus_mpl.use()           # light: Paper background — papers, light slides
# proteus_mpl.use("dark")   # dark: Void background — dark slides, hero figures
# proteus_mpl.use("white")  # light theme on pure white — journal pages

What you get

  • Cycles — both neutral-first, so a single-series plot draws in ink (light) / paper (dark) and magma stays a deliberate signal. Light (proteus_mpl.CYCLE, 9 colours): ink, magma, solar, verdant, ocean, tidal, outgassing, fog, azure; CVD worst-pair ΔE 15.7 (Machado 2009). Dark (CYCLE_DARK, 6 colours): paper, magma, solar, and light-safe tones; ΔE 16.8. Past the cycle, switch line style (solid/dashed/dotted/dash-dot) instead of adding hues, and keep legends on multi-series plots.
  • Accents — COLORS["solar"] (#E0A32E, the star) with COLORS["solar_deep"] (#C8860F) for gold fills or thin marks on light surfaces, and COLORS["verdant"] (#57A05C, the habitable endpoint).
  • Module domain colors — proteus_mpl.DOMAINS["interior"] etc, seven of them. Use these whenever a line is a module (SPIDER output → interior red, MORS → solar gold, Morrigan → accretion clay #A38F7A). Stable across every paper, talk, and diagram. Three of them are light in tone and thin out on a pale page: stellar gold at 2.0:1, atmosphere blue at 2.5:1, and accretion clay at 2.8:1 against Paper. Give those a legend rather than leaning on the hue for small marks.
  • Colormaps — proteus (sequential, Void→Paper; default for imshow / pcolormesh; the one ramp that survives greyscale reproduction), proteus_div (diverging, light midpoint — print-safe for anomalies/residuals), proteus_phase (the brand ramp, magma→void→ocean, dark midpoint — hero figures and dark slides). _r reversals registered.
  • Type — Instrument Sans labels, Spline Sans Mono available for ticks via fontfamily="Spline Sans Mono"; titles bold, left-aligned. The OFL brand fonts ship inside the package and register automatically on use().
  • Publication settings — 300 dpi savefig, tight bbox, TrueType embedding (fonttype 42), text-as-paths SVG. Prefer fig.savefig("fig.pdf").

The cycle on each surface

light cycle dark cycle

Regenerate with python examples/cycle.py.

Validation plots

proteus_mpl.validation.save writes one validation plot as a light and a dark file. With the same matplotlib and Pillow versions the same figure gives the same bytes, so the files can be committed next to the docs:

from proteus_mpl.validation import save

def make_figure():
    fig, ax = plt.subplots()
    ax.plot(t, model, label="model")
    ax.plot(t_ref, ref, "o", label="reference")
    return fig

save(make_figure, "melt_fraction", "docs/assets/validation")              # melt_fraction.svg, melt_fraction_dark.svg
save(make_heatmap, "phase_map", "docs/assets/validation", kind="map")     # phase_map.avif, phase_map_dark.avif

make_figure is called once per theme, so it must create the figure itself. Line and point plots (kind="line") are SVG with text as paths, no date, a fixed creator and a fixed hash salt; maps and heatmaps (kind="map") are AVIF at quality 80 with fixed encoder settings and need Pillow with AVIF support (pip install "proteus-mpl[validation]"). A file above 60 000 B (validation.MAX_BYTES) is refused with its name and size, and nothing is written; a dense field belongs in kind="map", while a small element drawn with rasterized=True can stay in an SVG as long as the file is under the cap. A name must not end in _dark, the suffix of the dark file. The test id and the command that makes the plot again go into the file metadata.

The package registers a pytest plugin, proteus_mpl.pytest_plugin, which needs pytest 7 or newer and loads by itself; a conftest does not need to list it. A test asks for the validation_plot fixture and calls it with the factory and a name:

@pytest.mark.reference_pinned
def test_melt_fraction(validation_plot):
    t, model = run_case()
    assert np.allclose(model, ref, rtol=1e-3)
    validation_plot(lambda: plot_case(t, model), "melt_fraction")

Without the option the fixture checks its arguments and writes nothing, so the test only asserts. pytest -m reference_pinned --validation-plots writes every plot to docs/assets/validation under the pytest rootdir; --validation-plots=DIR writes to another folder, relative to the rootdir. A bare --validation-plots followed by a word, which it would read as its folder, is refused, also from addopts or an @argfile, so write --validation-plots=DIR (always in addopts and PYTEST_ADDOPTS) or put the option after the test paths. A plot name used twice for one kind in a session is refused, with or without the option, so a parametrized test needs one name per parameter, such as f"case_{param}"; a rerun of the same test may use its names again. The reference_pinned marker belongs to the repository that runs the tests, which registers it in its pytest configuration. Under pytest-xdist each worker keeps its own list of names, so a name repeated in tests that run on different workers is not caught. The stamped command names a folder given with --validation-plots=DIR.

Conventions

  • Size figures at final printed size (A&A column ≈ 3.5 in) and keep default font sizes — never shrink a huge figure down.
  • Light figures on light surfaces, dark figures on dark — no visible card.
  • Journal white pages: use("white"), or transparent=True at savefig.
  • Magma is the hot signal: reserve it for the series you want the room to look at. Everything else starts from Ocean.

Metadata

Release files for proteus-mpl 1.4.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 proteus-mpl 1.4.0
File Size Uploaded Provenance
proteus_mpl-1.4.0.tar.gz 199.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for proteus-mpl 1.4.0
File Interpreter ABI Platform
proteus_mpl-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 387.3 kB

Release files / proteus_mpl-1.4.0.tar.gz

Download URL proteus_mpl-1.4.0.tar.gz
Size 199.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6d5ce3c082fb036807abe72497f9ceab65e8a91a9ae6b96aa7bfccc733b0a20f
BLAKE2b-256 checksum
How to use checksums
ec745bae7da31de7ce3e4afd9417026a337212c30feb5c6cea5473c10f562d06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 23, 2026.

Transparency log

Release files / proteus_mpl-1.4.0-py3-none-any.whl

Download URL proteus_mpl-1.4.0-py3-none-any.whl
Size 187.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b54e2b509fe225a3c467b329ae1e8186c6c5365ca83aef2ca8b82861e34a342
BLAKE2b-256 checksum
How to use checksums
471601c277c87c387b44ec6a0b1c818e76f25d354c31a3db44cb9e8b1dde7347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 23, 2026.

Transparency log

Security for proteus-mpl 1.4.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 proteus_mpl-1.4.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 Oct 23, 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.

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