pyplotutil: plotting utility for academic publications
pyplotutil is a wrapper library of polars and matplotlib, which allows you to handle time series data easily and create graphs tolerable to scientific publications.
Features
- Load tabular data from CSV, Parquet, JSON/NDJSON, or Excel files,
buffers, or polars frames with column-attribute access
(
data.time,data.voltage) - Group rows by a tag column (
TaggedData,load_tagged_data) or manage whole directories of data files (Dataset) - Plot multiple time series and mean-with-error graphs (standard deviation, standard error, variance, range, confidence interval)
- Plot directly from data objects: one line per file for a
Dataset, one labeled line per tag forTaggedData - Apply publication-ready matplotlib styles
(SciencePlots):
science,ieee,nature,notebook - Annotate plotted lines with boxed labels and arrows
(
annotate_with_arrow) and add direction arrowheads along trajectories (add_direction_arrows) - Highlight time spans from boolean masks (
shade_spans) and configure axes cosmetics in one call (setup_axes) - Save figures to multiple formats in one call with sanitized filenames
- Event logging helpers with file and console output
Installation
Requires Python 3.11+.
pip install git+https://github.com/hrshtst/pyplotutil.git
Interactive plotting with plt.show() needs a GUI backend, which is
provided by the optional gui extra:
pip install "pyplotutil[gui] @ git+https://github.com/hrshtst/pyplotutil.git"
Quickstart
import matplotlib.pyplot as plt
from pyplotutil import Data, Dataset, apply_style, plot_mean_err, save_figure
# Publication-ready style.
apply_style("science", no_latex=True)
# Load a single CSV file; columns are accessible as attributes.
data = Data("experiment.csv")
fig, ax = plt.subplots()
ax.plot(data.t, data.position)
# Load every CSV file in a directory and plot mean with standard error.
dataset = Dataset("results/")
plot_mean_err(ax, dataset, "position", "se", capsize=2, label="mean")
# Write figure.png and figure.pdf in one call.
save_figure(fig, "output", "figure", ["png", "pdf"])
Group rows by a tag column:
from pyplotutil import TaggedData
tagged = TaggedData("trials.csv", tag_column="trial")
for tag, data in tagged:
print(tag, data.param("gain"))
Development
uv sync # set up the development environment
uv run pytest # run the test suite
uv run mypy # type check
uv run ruff check # lint
nox # lint + type check + tests on Python 3.11-3.14
License
Metadata
Release files for pyplotutil 2.1.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 | |
|---|---|---|---|
| pyplotutil-2.1.0.tar.gz | 159.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyplotutil-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 190.2 kB
Release files / pyplotutil-2.1.0.tar.gz
| Download URL | pyplotutil-2.1.0.tar.gz |
|---|---|
| Size | 159.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bc05add4f66723864c5f357db1aa17b6283e9030d05c15652f191fd847719a7
|
|
BLAKE2b-256 checksum How to use checksums |
29465ccd17615b959c9fe66e6dd17ea9b6198288dd1415a1dad0f72e80ff1fc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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 / pyplotutil-2.1.0-py3-none-any.whl
| Download URL | pyplotutil-2.1.0-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bb958cdb000f68df9cedf0bee1874c6462e7793efd6bcaa2ea42f7f1ae5884d
|
|
BLAKE2b-256 checksum How to use checksums |
4add002e578426c3abaf7fc65a7161974712085f4c4b9e3e675ba19c41c917c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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}
|