Skip to main content

Save Matplotlib figures as editable .mpe desktop files.

Project description

MatPlotEdit

Editable MATLAB .fig-style desktop files for Matplotlib.

matplotedit.save(fig, "plot.mpe") stores the Matplotlib figure as a portable JSON schema. matplotedit open plot.mpe launches a PyQt6 desktop editor where you can pan/zoom, edit titles, labels, limits, scales, trace colors, visibility, and export to PNG/SVG/PDF.

Install

From PyPI:

pip install matplotedit

From this folder:

pip install -e .

If PyQt6 is not already installed, the command above installs it with the package dependencies.

Save A Figure

import matplotlib.pyplot as plt
import matplotedit

fig, ax = plt.subplots(figsize=(8, 5))
ax.plot([1, 2, 3, 4], [2, 4, 1, 6], label="Series A", color="#e94560")
ax.scatter([1, 2, 3, 4], [1, 3, 5, 2], label="Points", color="#0f8fff")
ax.set_title("Demo")
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.legend()
ax.grid(True)

matplotedit.save(fig, "demo.mpe", open_after=True)

Open A File

matplotedit open demo.mpe

or:

import matplotedit
matplotedit.open_viewer("demo.mpe")

Inspect Metadata

matplotedit info demo.mpe

Desktop Editor Features

  • Matplotlib navigation toolbar: pan, zoom, reset, configure, save image.
  • Figure editor: title, size, DPI, background color.
  • Figure size controls include numeric inputs and sliders for width, height, and DPI.
  • Selected plot box controls let you resize/reposition the active subplot and change that subplot's background color independently. The active plot is shown and selectable directly in the Figure tab.
  • Axes editor: title, X/Y labels, X/Y limits, linear/log scales, grid toggle, font family, tick font size, title font size, label font size, and explicit X/Y tick values.
  • Axis label position controls let you move the X/Y labels in axes coordinates.
  • Grid editor: major grid, minor grid, color, alpha, line style, and line width.
  • Legend editor: visibility, title, font family, font size, frame, location, and X/Y anchor. Legends are also draggable inside the figure. A dragged legend keeps priority across redraws and figure-size edits until you choose Use Code Location.
  • Trace editor: label, color, line width, alpha, visibility.
  • Marker editor: marker type, size, fill color, edge color, edge width, and marker alpha for line/scatter plots.
  • Line/patch editor: line style, draw style, line width, bar edge color, and bar hatch where those properties apply.
  • Text editor: add/delete custom text with data-position, font family, font size, color, rotation, visibility, and direct dragging in the plot.
  • Default text styling is Times New Roman, 18 pt for generic Matplotlib fonts.
  • Data inspector: hover near a point to read X/Y values, click near a point to pin a callout on the figure. Line, scatter, and bar data are supported.
  • Zoom out: use the toolbar Home button, the toolbar Back button, or View > Reset View / Zoom Back.
  • Direct editing: double-click an axes title, X label, Y label, tick label, or legend to jump to the matching editor field.
  • Figure-layout pan: View > Pan Figure Layout moves all axes boxes together.
  • File menu: open, save, save as, export PNG/SVG/PDF.

Test Everything

python test_all_plots.py
python test_plot_types_separate.py
matplotedit open MatPlotEdit_all_plots.mpe
matplotedit open MatPlotEdit_matlab_style.mpe

Backward Compatibility

Older .mpe files created as self-contained HTML still load. The new default format is JSON because it is better suited to a desktop app.

To keep generating the old browser file:

matplotedit.save_html(fig, "demo.html")
# or
matplotedit.save(fig, "demo.mpe", legacy_html=True)

Supported Plot Types

Matplotlib call Desktop rendering
ax.plot() Line
ax.scatter() Scatter
ax.bar() Bar
ax.imshow() Image
ax.annotate() Annotation
Multiple axes Multiple Matplotlib axes

Build A Windows App

Install PyInstaller:

pip install pyinstaller

Build an executable launcher:

python -m PyInstaller --name MatPlotEdit --windowed --collect-all PyQt6 --collect-all matplotlib matplotedit\__main__.py

The executable will be created under dist\matplotedit.

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

matplotedit-1.0.0.tar.gz (51.5 kB view details)

Uploaded Source

Built Distribution

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

matplotedit-1.0.0-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file matplotedit-1.0.0.tar.gz.

File metadata

  • Download URL: matplotedit-1.0.0.tar.gz
  • Upload date:
  • Size: 51.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for matplotedit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f12e869b5c4085301ee262079abcebfe4375cd0838b93b8007e341fb233c6458
MD5 df6c11020dfd0d8815ca0f27631e13ff
BLAKE2b-256 6ee0643a6329319962f2a2db82ed37382060b235cec34e60cf0617cd70d5af8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for matplotedit-1.0.0.tar.gz:

Publisher: publish.yml on tanuj163/matplotedit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matplotedit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: matplotedit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 51.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for matplotedit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d91eb6f0f77ef6442a872aa87137526a6c578af79a4bf612839c66898138268
MD5 15ab4401e9c640902a39f32616d39a01
BLAKE2b-256 1455611fcfa6be260252e12069ec64da0e03d1f905de1ad4b483c98623dc50a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for matplotedit-1.0.0-py3-none-any.whl:

Publisher: publish.yml on tanuj163/matplotedit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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