Skip to main content

mpl-measurements add measurements to your matplotlib plots

Project description

mpl-measurements

Interactive measurement tools for Matplotlib.

Click two points on any plotted line to compute engineering-style measurements such as Δx, Δy, and signal statistics (min, max, RMS) over a selected interval.

mpl-measurements

To use it, simply call InteractiveScope(fig) where fig is your figure. Example:

import numpy as np
import matplotlib.pyplot as plt

from mpl_measurements import InteractiveScope


x = np.linspace(0, 10, 1000)
fig, axs = plt.subplots(2, 2, sharex=True)
axs = axs.flatten()

for ii, ax in enumerate(axs):
    ax.plot(x, np.sin(x + ii), label=f"sin {ii}")
    ax.plot(x, np.cos(x + ii), label=f"cos {ii}")
    ax.set_title(f"Axes {ii}")
    ax.legend()

InteractiveScope(fig) # This is the line!

# You can also call e.g. InteractiveScope(fig, axes=[axs[0], axs[1]]) if you
# want the measurements tool active only on axes axs[0], axs[1]. See
docstring for more info.

plt.show()

⚠️ Notes on layout engines

If a Matplotlib layout engine is used (e.g. "tight" or "constrained"), you must reserve space on the right side using rect:

    fig.set_layout_engine("tight", rect=[0, 0, 0.75, 1])>[Info]

Otherwise, the info panel may overlap with the plot axes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpl_measurements-0.0.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpl_measurements-0.0.5-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file mpl_measurements-0.0.5.tar.gz.

File metadata

  • Download URL: mpl_measurements-0.0.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for mpl_measurements-0.0.5.tar.gz
Algorithm Hash digest
SHA256 044cfb7c7e4ae9eb8a4a27772dac72db24ae4b730a0cb0c8bd8fe364dce6177f
MD5 46b87de86c8acc29a773170d6939bce0
BLAKE2b-256 fcb2500be4bb5a6cb2e8af8ad2b3e8c3d481aea2f6a0fdf8e1c54ecf8fc01fb0

See more details on using hashes here.

File details

Details for the file mpl_measurements-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mpl_measurements-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d888139731bed1460185b53f3715ee031510fb8f312fb14165ed2938e41ba8cb
MD5 0d20009f406c79a373a7d4776d28de24
BLAKE2b-256 8b64e2e850e9bfb0d17717bbb5fc655ed3c09fb07997959e88c9658cec48bfee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page