plotops
Structured plotting utilities built on top of matplotlib.
plotops provides:
- Reproducible subplot layouts with cm-based sizing
- Clean multi-source plotting helpers
- Publication-ready export utilities
- Interactive workflow tools such as log toggle, pop-out, and tiling
Designed for engineering and scientific workflows where layout consistency matters.
Install
pip install plotops
Current runtime dependencies:
numpymatplotlibmplcursorsPyQt5
Core Modules
plotops.figure
Layout and figure control:
layout()computes figure size and normalized layout parameterssubplot()creates tightly controlled subplot grids as a 2D axes array and can apply labels, log scaling, limits, and grids;ylabelmay be a single string, one label per row, or one label per axis in row-major orderfinish()applies standard post-plot finishing for custom subplot workflowsaxistight()applies MATLAB-style axis paddingsize()resizes and repositions the figure windowtile()tiles all open figures on screenlog_toggle()toggles linear and log scale interactivelyenable_popout()pops the active axes into a new figure
plotops.plot
High-level plotting utilities:
plotxy()creates multi-source row-wise plots and acceptssuptitle=...plot_timefreq()creates 2-column time/FFT subplot grids and supports the same common plotting arguments asplotxy()such assuptitle=..., plus time/FFT-specific optionsplot3d()flattens 3D matrix data into structured subplot layoutscorr()converts covariance matrices to correlation plotssurfiso()plots triangulated 3D surfaces with isolines
plotxy(..., return_all=True) returns all generated figures, axes groups, and line groups when one call spans multiple figures.
plotxy() accepts either one shared x-array per source or one x-array per subplot row, which allows wrappers such as plot_timefreq() to reuse the same legend and layout behavior.
The top-level alias plotops.multiplot(...) points to plotxy(), so it also supports suptitle=....
plotops.legacy
Legacy APIs are kept in plotops.legacy so older workflows remain available without crowding the main modules.
Quickstart
import numpy as np
import plotops
x1 = np.linspace(0, 10, 100)
x2 = np.linspace(0, 10, 400)
y1 = 20 * np.cos(x1) + 40
y2 = 20 * np.sin(x2) + 50
fig_layout = plotops.figure.layout(1, 1)
fig_out = plotops.plot.plotxy(
[x1, x2],
[y1, y2],
labels=["Case A", "Case B"],
suptitle="Main title",
layout_kwargs=fig_layout,
)
plotops.print.savefig(
fig_out["fig"],
"plot_example_1",
".",
figsize=fig_layout["figsize"],
formats=["pdf", "png"],
)
Manual Plotting
For cases where you want the layout helper but will add lines or scatter plots manually:
layout = plotops.layout(2, 1)
axes, fig, _ = plotops.subplot(
2, 1,
layout=layout,
xlabel="t [s]",
ylabel=["Signal 1", "Signal 2"],
ylog=False,
)
axes[0, 0].plot(x, y1)
axes[1, 0].scatter(x, y2)
plotops.finish(
fig,
axes,
suptitle="Main title",
)
plotops.finish() is the recommended way to give custom subplot-based figures the same kind of post-plot behavior that high-level helpers already provide automatically, including axis tightening, figure-level legend placement, hiding unused padded axes, cursor hookup, and interactive figure helpers.
For plotops.subplot(...), ylabel supports three explicit forms:
- a single string to apply to every axis
- a list of length
nrowto apply one y-label per subplot row across all columns - a list of length
nrow * ncolto apply one y-label per axis in row-major order
For example, ylabel=["MSD", ""] on a 2 x 1 or 2 x 2 subplot grid labels the first row as MSD and leaves the second row unlabeled.
Time And Frequency
For repeated "time on the left, FFT on the right" plots, use plot_timefreq():
fig_layout = plotops.layout(2, 2)
fig_out = plotops.plot_timefreq(
[t_a, t_b],
[y_a, y_b],
labels=["Case A", "Case B"],
ylabel=["Response 1", "Response 2"],
suptitle="Main title",
layout_kwargs=fig_layout,
)
This keeps the same legend/layout behavior as plotxy() while internally building one time row and one positive-frequency FFT row per signal. In practice, plot_timefreq() supports the common plotxy() options such as labels, color, linestyle, linewidth, legend, layout_kwargs, and suptitle, and adds time/frequency-specific arguments such as time_xlabel, freq_xlabel, fft_ylabel, time_xlim, freq_xlim, and ylog_freq.
Examples
The example scripts live in examples:
- example1.py: 2D plotting workflows
- example2.py: surface and isoline plotting
- example3.py: matrix-style subplot layouts
- example4.py: 3D matrix plotting
Example outputs:
Metadata
Release files for plotops 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| plotops-1.1.tar.gz | 38.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| plotops-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.3 kB
Release files / plotops-1.1.tar.gz
| Download URL | plotops-1.1.tar.gz |
|---|---|
| Size | 38.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f49f8236041be010336f6103d881f98af424809da8be6a8663d7fbf8dd1fbd36
|
|
BLAKE2b-256 checksum How to use checksums |
a53ac167c58f27952d23b76cfdc22c2a01857f03bdf20d02bfc2cdd71d4f8a37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / plotops-1.1-py3-none-any.whl
| Download URL | plotops-1.1-py3-none-any.whl |
|---|---|
| Size | 38.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5296be84305bdb5cce3f8c6544b5455109012962c3438915f3935952691fa30
|
|
BLAKE2b-256 checksum How to use checksums |
c3a15795ed32ef028a1ec074e606dda7f3f27c8c3fbb5e8afad2d82be550886f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|