mpl-lego
mpl-lego is a small collection of reusable utilities for building and
styling Matplotlib figures. It includes helpers for
subplot labels, covariance ellipses, colorbars, legends, scatter plots, colors,
and consistent axis styling.
Installation
Install the latest release from PyPI:
python -m pip install mpl-lego
mpl-lego supports Python 3.11 and newer and depends on Matplotlib and NumPy.
Quick start
import matplotlib.pyplot as plt
import numpy as np
from mpl_lego.axes import style_panel_axis
from mpl_lego.labels import apply_subplot_labels
from mpl_lego.scatter import tighten_scatter_plot
rng = np.random.default_rng(42)
observed = rng.normal(size=100)
predicted = observed + rng.normal(scale=0.35, size=100)
fig, ax = plt.subplots(figsize=(5, 5))
ax.scatter(observed, predicted, alpha=0.7)
style_panel_axis(ax, grid_axis="both")
tighten_scatter_plot(ax, color="black", linestyle="--")
apply_subplot_labels(ax, labels=["a"])
ax.set(xlabel="Observed", ylabel="Predicted")
fig.tight_layout()
plt.show()
Utilities
| Module | Helpers |
|---|---|
mpl_lego.axes |
Style an axis or append a marginal axis. |
mpl_lego.colorbar |
Map values to colors and append matched colorbars. |
mpl_lego.colors |
Read the active color cycle and convert hex colors. |
mpl_lego.ellipse |
Plot a two-dimensional covariance ellipse. |
mpl_lego.labels |
Format labels, label subplots, and draw significance brackets. |
mpl_lego.legend |
Build marker-based legend handles. |
mpl_lego.scatter |
Equalize scatter-plot limits and add an identity line. |
mpl_lego.style |
Enable Computer Modern and LaTeX text rendering when available. |
All public functions include NumPy-style docstrings with their parameters and return values.
Development
Development uses uv for dependency management, virtual environments, testing, and package builds:
git clone https://github.com/pssachdeva/mpl-lego.git
cd mpl-lego
uv sync
uv run pytest
uv build
uv sync creates the project environment from uv.lock and installs the
development dependency group automatically.
Three known regressions are tracked in the issue tracker. Their tests are marked as expected failures until the corresponding fixes land.
License
mpl-lego is distributed under the
MIT License.
Metadata
Release files for mpl_lego 0.0.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 |
|---|---|---|---|---|
| mpl_lego-0.0.4.tar.gz | 14.3 kB | Without provenance | Details for mpl_lego-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mpl_lego-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for mpl_lego-0.0.4-py3-none-any.whl |
Total release size: 26.2 kB
Release files / mpl_lego-0.0.4.tar.gz
| Download URL | mpl_lego-0.0.4.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c0adda52c55c0878ee6b93a16aa9498b053a97297f6e7b974b8c59db3ad89d9
|
|
BLAKE2b-256 checksum How to use checksums |
91dc9884f9a1b1f6096a8a15c1724c0e453ec93a03bb2e87d5d101adc1f9a187
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mpl_lego-0.0.4-py3-none-any.whl
| Download URL | mpl_lego-0.0.4-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c8eead19ee47ace524e67b67cebcd24780087a56021a381d5bf017eaf9763e5
|
|
BLAKE2b-256 checksum How to use checksums |
73f3528a66b79e47b604211e4bda9db087c11d3cdb33e5781f450042eda010ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mpl_lego 0.0.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.