Minimal plotting utilities for consistently formatted scientific matplotlib figures.
import myplots as p
p.use_style()
fig, ax = p.new()Clone the repository and install in editable mode:
pip install -e .import numpy as np
import myplots as p
# Apply global plotting style
p.use_style(doc_fontsize=10, fig_width="single")
# Generate some data
x = np.linspace(0, 10, 100)
y = np.sin(x)
# Create figure
fig, ax = p.new()
# Plot
p.line(ax, x, y, label="signal")
p.label(ax, rf"{p.bm('x')} axis", rf"{p.bm('y')} axis")
p.legend(ax)
# Save
p.save(fig, "figure.png")p.line(ax, x, y)
p.scatter(ax, x, y)
p.errorbar(ax, x, y, yerr)fig, axs = p.new(nrows=2, ncols=2)p.label(ax, "x", "y", "Title")
p.legend(ax)p.annotate_subplots(axs)p.plot_energy(ax, t, E)
p.plot_temperature(ax, t, T)
p.plot_histogram(ax, data)
p.plot_with_error(ax, x, y, yerr)