Skip to main content

Export Matplotlib figures directly to editable native MATLAB .fig files using the MATLAB Engine API.

Project description

Matlabfigexporter

Export Matplotlib figures directly to editable native MATLAB .fig files using the MATLAB Engine API.

PyPI Python License

Overview

Matlabfigexporter is a lightweight Python package that allows you to export Matplotlib figures as native MATLAB .fig files.

Unlike PNG, SVG, PDF, or EPS exports, the generated .fig file remains fully editable in MATLAB. Titles, axes, legends, labels, and other plot elements can be modified using MATLAB's Figure Editor.

The package is designed for researchers, engineers, students, and scientists who work with both Python and MATLAB.


Features

  • Export Matplotlib figures directly to native MATLAB .fig
  • Familiar Matplotlib-style API
  • Editable figures in MATLAB
  • Automatic detection of the MATLAB Engine
  • Automatic MATLAB Engine installation attempt (if supported)
  • Lightweight and easy to use
  • Open source
  • Windows support (tested)
  • Tested with MATLAB R2026

Installation

Install from PyPI:

pip install Matlabfigexporter

Requirements

  • Python 3.8+
  • MATLAB installed
  • MATLAB Engine for Python

If the MATLAB Engine is not available, Matlabfigexporter will attempt to install it automatically when first imported. If automatic installation is unsuccessful, a clear error message is displayed with instructions for manual installation.


Quick Start

from Matlabfigexporter import plt

x = [1, 2, 3, 4]
y = [1, 4, 9, 16]

plt.figure(figsize=(6,4))
plt.plot(x, y, linewidth=2, label="y = x²")

plt.title("Example Figure")
plt.xlabel("X")
plt.ylabel("Y")
plt.legend()
plt.grid(True)

plt.savefig("example.fig")

Open the figure in MATLAB:

openfig("example.fig")

Why use Matlabfigexporter?

Normally, Matplotlib exports figures as image or vector formats:

  • PNG
  • JPG
  • SVG
  • PDF
  • EPS

These formats are not editable as MATLAB figures.

Matlabfigexporter creates a native MATLAB .fig that can be opened and modified just like figures created inside MATLAB.


Typical Use Cases

  • Scientific publications
  • Engineering reports
  • Signal processing
  • Control systems
  • Machine learning visualization
  • Optical communication research
  • Data analysis
  • Academic research
  • MATLAB/Python interoperability

Example Workflow

Matplotlib
      │
      ▼
Matlabfigexporter
      │
      ▼
Native MATLAB .fig
      │
      ▼
Open & Edit in MATLAB

Compatibility

Component Status
Windows ✅ Tested
Linux Planned
macOS Planned
MATLAB R2026 ✅ Tested

Project Structure

Matlabfigexporter/
│
├── src/
├── examples/
├── tests/
├── README.md
├── LICENSE
└── pyproject.toml

Roadmap

Planned improvements include:

  • Linux support
  • macOS support
  • Additional Matplotlib artist support
  • Improved compatibility with future MATLAB releases
  • More examples and documentation
  • Automated testing

Contributing

Contributions, feature requests, and bug reports are welcome.

If you find a bug or have an idea for an improvement, please open an issue or submit a pull request.

GitHub Issues:

https://github.com/adityak1911/Matlabfigexporter/issues


Citation

If this package is useful in your research, consider citing the GitHub repository or linking to the PyPI project.


Author

Aditya Kumar

GitHub:

https://github.com/adityak1911/Matlabfigexporter

PyPI:

https://pypi.org/project/Matlabfigexporter/


License

This project is licensed under the MIT License.


Support

If you encounter any issues or have suggestions for new features, please open an issue on GitHub.

Feedback and contributions are always appreciated.

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

matlabfigexporter-0.0.2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

matlabfigexporter-0.0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file matlabfigexporter-0.0.2.tar.gz.

File metadata

  • Download URL: matlabfigexporter-0.0.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for matlabfigexporter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fca0c79cac6c4544ad8f3ee62cac5a075662c10e2db2abda256e56693a4658f5
MD5 a0ab2ac2d94429b18bab1ffb4984ef92
BLAKE2b-256 278d26f00f383d7f248c71d19f16d09d89b7215ec7b2f91d121d1d279380f8e2

See more details on using hashes here.

File details

Details for the file matlabfigexporter-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for matlabfigexporter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 869d117224ca4d5a0cf80fe11b289fe7354d268917fd7009633db4ba368d59db
MD5 042b212c1ebdb33aae79e62f17781626
BLAKE2b-256 1ed10fea079a65e817b3deee16ead7d724ac41bbec3213c40d34ab7127cf7df7

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