plotwright
A small matplotlib companion for consistent, presentable figures: a composable color/linestyle/
marker theme system, and a FigureSaver for exporting whole figures or single cropped subplots at
a fixed, reproducible size.
- Github repository: https://github.com/AdamHallengreen/plotwright/
Installation
pip install plotwright
or, with uv:
uv add plotwright
Quickstart
import matplotlib.pyplot as plt
from plotwright import FigureSaver, apply_theme
apply_theme("vibrant", base="paper") # both are defaults; shown here for clarity
fig, ax = plt.subplots()
ax.plot([0, 1, 2], [0, 1, 4], label="series 1")
ax.legend()
FigureSaver("figures").save_figure(fig, "example.png")
apply_theme sets matplotlib rcParams for the rest of the session -- scope it to one figure with
plt.rc_context() if you need more than one theme active side by side. FigureSaver handles
writing figures to disk at a consistent size.
Palettes, bases, linestyles & markers
apply_theme(palette=, *, base=, linestyle=, marker=, ...) layers a base theme with a color cycle,
and optionally a linestyle/marker cycle alongside it. Every name below is also available
programmatically, so you're never guessing:
from plotwright import list_bases, list_palettes, list_linestyle_sets, list_marker_sets
list_bases() # ('paper', 'presentation')
list_palettes() # ('fishy', 'ggplot2', 'ibm', 'okabe_ito', 'petroff10', ...)
list_linestyle_sets() # ('basic',)
list_marker_sets() # ('basic',)
base= |
Use case |
|---|---|
paper (default) |
Print/PDF figures -- compact, serif |
presentation |
On-screen slides -- larger scale, sans-serif |
Palettes (palette=): vibrant (default), fishy, ggplot2, ibm, okabe_ito, petroff10,
seaborn_deep, tab10, tol_bright, tol_muted. Linestyle sets and marker sets
(linestyle=/marker=): basic. Preview a palette's actual colors without applying it via
palette_colors("vibrant").
Pass your own colors instead of a named palette with colors=[...] (a list of hex strings), and
layer extra rcParams on top with extra_rc= (a dict, or a path to another .mplstyle file). See
notebooks/demo.ipynb for a runnable tour of every option, including a
side-by-side swatch of all palettes, sequential=, and latex=True.
Saving figures
saver = FigureSaver("figures", dpi=300)
saver.save_figure(fig, "whole_figure.png") # fixed size, no tight bbox
saver.save_subplot(fig, ax, "one_panel.png") # cropped to that axes' tight bbox
saver.save_subplots_aligned(fig, [ax1, ax2], ["a.png", "b.png"]) # cropped to a common width
Use mark_rasterized(*artists) to rasterize dense scatter/heatmap artists before saving to a
vector format (pdf/eps/ps) -- keeps text and axes vector while the heavy artist becomes a bitmap.
Contributing
See CONTRIBUTING.md.
License
MIT -- see LICENSE.
Metadata
Release files for plotwright 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plotwright-0.1.4.tar.gz | 721.2 kB | Without provenance | Details for plotwright-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plotwright-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for plotwright-0.1.4-py3-none-any.whl |
Total release size: 741.2 kB
Release files / plotwright-0.1.4.tar.gz
| Download URL | plotwright-0.1.4.tar.gz |
|---|---|
| Size | 721.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a2ed49c66bc3261328d9e4c17686c62cab4d87ac39264c4d92c895824f811fb
|
|
BLAKE2b-256 checksum How to use checksums |
654444bc394a0369433947e4cae9db4307a91eab027931eb6dc70d4046df8e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / plotwright-0.1.4-py3-none-any.whl
| Download URL | plotwright-0.1.4-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2782496af17db8f135fae1d4c677941eb449df552b5de1fe240abea189e9f329
|
|
BLAKE2b-256 checksum How to use checksums |
e8f53c9b3b60198763bc41dc640df660ecb4e4137c809146ba709c58be42afba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for plotwright 0.1.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.