You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mplfig

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mplfig

Save and load matplotlib figures like MATLAB's .fig files!

1.0.1
pipPyPI
Maintainers
1

mplfig

Matplotlib by default only allows you to export your figures in formats that are used for publishing (e.g., a .pgf file, a resterized .png file, etc.). MATLAB allows you to save files in a .fig format which allows you to change the plot very easily (say, to fix a typo on an axis label, or to change the colorscheme). mplfig strives to bring this functionality to matplotlib. With mplfig, you can save your matplotlib files and load them right back up in another python script.

Example

First, create a figure and save with it mplfig.

import mplfig
import matplotlib.pyplot as plt

xs = list(range(10))
ys = list(map(lambda x: x**2, xs))

plt.plot(xs, ys)
mplfig.save_figure(plt.gcf(), 'myfig.mplpkl')

plt.show()

Before

Next, load it back up and change the figure!

import mplfig
import matplotlib.pyplot as plt

fig = mplfig.load_figure('myfig.mplpkl') # Load the saved figure

axes = fig.get_axes()
axes[0].set_xlabel('$x$') # Add an x label
axes[0].set_ylabel('$y = x^2$') # Add a y label
axes[0].lines[0].set_marker('o') # Add a circle marker

plt.show()

After

Install

mplfig is on PyPI

pip3 install -U mplfig

Keywords

MATLAB

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.