matplotlabs
Matplotlib style sheets and colormaps for scientific publications.
matplotlabs gives you publication-ready defaults for figures — clean sans-serif
fonts, trimmed spines, constrained layout, and carefully designed color palettes —
so you can focus on the science instead of the formatting.
Installation
pip install matplotlabs
For development:
pip install matplotlabs[dev]
Quick start
import matplotlabs as mpll # registers styles, colormaps, and named colors on import
import matplotlib.pyplot as plt
plt.style.use("mpll")
fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4])
ax.set_xlabel("x")
ax.set_ylabel("y")
fig.savefig("figure.pdf")
That's it. The mpll style applies publication-ready defaults — sans-serif fonts
(Arial/Helvetica), 3.5 in single-column width, 7 pt font size, no top/right spines,
inward ticks, constrained layout, and PDF output.
Styles
Styles are composable — stack them in any order with plt.style.use([...]).
| Style | Description | Usage |
|---|---|---|
mpll |
Default scientific style. Sans-serif (Arial/Helvetica), 3.5 in width, 7 pt fonts, no top/right spines, inward ticks, 8-color qualitative cycle, constrained layout, PDF save. | plt.style.use("mpll") |
qualitative |
Explicit 8-hue qualitative color cycle at mid-saturation. Same as the default cycle — use when you want to apply the palette without the full base style. | plt.style.use("qualitative") |
latex |
LaTeX text rendering modifier. Enables text.usetex with Helvetica via helvet + sfmath. Requires a LaTeX installation. |
plt.style.use(["mpll", "latex"]) |
Composition examples
# Default style with LaTeX rendering
plt.style.use(["mpll", "latex"])
# Just the default style
plt.style.use("mpll")
# Only the color cycle, nothing else
plt.style.use("qualitative")
Named colors
All colors use the mpll: prefix (similar to tab:blue) and work anywhere
matplotlib accepts a color string. Each hue family has 6 shades numbered
1 (lightest) to 6 (darkest). The unadorned name maps to shade 4.
| Family | mpll:{name} (shade 4) |
Shades 1-6 |
|---|---|---|
lightone |
#A5A083 |
warm cream to dark khaki |
grey |
#6E788D |
light grey to dark slate |
red |
#C5373D |
light pink to dark red |
blue |
#006EAE |
light blue to dark navy |
yellow |
#CA9B23 |
light yellow to dark amber |
olive |
#96A00A |
light lime to dark olive |
green |
#429130 |
light green to dark green |
teal |
#0096A0 |
light teal to dark teal |
purple |
#A1478E |
light lavender to dark purple |
orange |
#E26600 |
light peach to dark orange |
skin |
#8D6651 |
light beige to dark brown |
Usage
import matplotlabs as mpll
import matplotlib.pyplot as plt
plt.style.use("mpll")
fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4], color="mpll:red") # shade 4 (default)
ax.plot([0, 1, 2], [4, 1, 0], color="mpll:blue1") # lightest blue
ax.axhline(2, color="mpll:grey6") # darkest grey
Programmatic access
mpll.colors["red"] # ['#F6CECA', '#E9A0A5', '#DC6464', '#C5373D', '#9B241C', '#730C0D']
mpll.colors["lightone"] # ['#F6F2EE', '#E0DCCA', '#C5C1A5', '#A5A083', '#888364', '#5E5948']
Colormaps
All colormaps use the mpll- prefix and are registered automatically on import.
Each colormap also has a reversed variant with the _r suffix.
Sequential
| Colormap | Colors |
|---|---|
mpll-red |
light pink to dark red |
mpll-blue |
light blue to dark navy |
mpll-teal |
light teal to dark teal |
mpll-green |
light green to dark green |
mpll-yellow |
light yellow to dark amber |
mpll-orange |
light peach to dark orange |
mpll-purple |
light lavender to dark purple |
mpll-grey |
light grey to dark slate |
mpll-olive |
light lime to dark olive |
mpll-lightone |
warm cream to dark khaki |
mpll-skin |
light beige to dark brown |
Diverging
| Colormap | Description |
|---|---|
mpll-red-blue |
Red ← white → blue |
mpll-orange-teal |
Orange ← white → teal |
mpll-purple-green |
Purple ← white → green |
Usage
import matplotlabs as mpll
import matplotlib.pyplot as plt
import numpy as np
data = np.random.randn(10, 10)
fig, ax = plt.subplots()
im = ax.imshow(data, cmap="mpll-red-blue")
fig.colorbar(im, ax=ax)
# Reversed variant
im2 = ax.imshow(data, cmap="mpll-red-blue_r")
Utilities
annotate_heatmap
Overlay formatted numbers on each cell of a heatmap with automatic text color contrast (dark text on light cells, light text on dark cells).
import matplotlabs as mpll
import matplotlib.pyplot as plt
import numpy as np
plt.style.use("mpll")
data = np.array([[1.0, -0.5, 0.3], [-0.8, 0.001, 2500]])
fig, ax = plt.subplots()
im = ax.imshow(data, cmap="mpll-red-blue")
mpll.annotate_heatmap(im, data)
fig.colorbar(im, ax=ax)
fig.savefig("heatmap.pdf")
Parameters:
im— TheAxesImagereturned byax.imshow().data— The 2-D numpy array used to create the image.fmt— Explicit format string (e.g."{:.2f}"). WhenNone, each cell auto-selects between fixed-point, scientific notation, or integer formatting.sci_threshold— Magnitude threshold for scientific notation (default1e3).fontsize— Annotation font size. Defaults torcParams["font.size"] - 1.textcolors— Tuple of(low_color, high_color)for contrast. Default("black", "white").threshold— Colormap midpoint for switching text color. Defaults to(vmin + vmax) / 2.
Default style (mpll)
The mpll style sets these key rcParams:
| Parameter | Value |
|---|---|
| Font family | Sans-serif (Arial, Helvetica) |
| Font size | 7 pt |
| Figure size | 3.5 x 2.5 in |
| Figure DPI | 450 |
| Save DPI | 300 |
| Save format | |
| Spines | Bottom + left only |
| Ticks | Major only, inward, no minor |
| Layout | Constrained layout |
| Legend | No frame, 6 pt |
| Grid | Off |
| Marker size | 3 |
| Color cycle | 8 hues at mid-saturation |
Development
# Clone and install in editable mode
git clone https://github.com/lvvittor/matplotlabs.git
cd matplotlabs
pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check .
ruff format .
# Generate example figures
python examples/plot.py
License
Release files for matplotlabs 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| matplotlabs-0.2.0.tar.gz | 52.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| matplotlabs-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.4 kB
Release files / matplotlabs-0.2.0.tar.gz
| Download URL | matplotlabs-0.2.0.tar.gz |
|---|---|
| Size | 52.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96c4d756385d21f0f86f96554f3b5ff2fce52ed5e0bc40fcc8969c6f94353644
|
|
BLAKE2b-256 checksum How to use checksums |
0dbdeffe83fcade178b45cf4ca3302fd4b9084474efc4d65b4054d90ea893a97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 16, 2026.
Transparency logRelease files / matplotlabs-0.2.0-py3-none-any.whl
| Download URL | matplotlabs-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f50417f8c4e02ea81dd5649e1c87c164e67727e77690c558167fe3c2018fd84f
|
|
BLAKE2b-256 checksum How to use checksums |
c74f30921748166d4ec2a204197aea375b0c85cc85e92cc67c31041a8ec29806
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Feb 16, 2026.
Transparency log