pylustrator icon indicating copy to clipboard operation
pylustrator copied to clipboard

Feature request: loading and editing pickle-dumped figures

Open arashgmn opened this issue 2 years ago • 1 comments

First of all, awesome work! Thank you.

Matplotlib folks suggest saving figure objects as a pickle for later modification.

import matplotlib.pyplot as plt
import pickle 

# plot a fancy figure
# ...

fig = plt.gcf()
pickle.dump(fig, open('figObj.pickle', 'wb')) # for future

I was thinking it would be truly amazing if pylustrator could pick up the editing job from those saved picked. Something like this:

import matplotlib.pyplot as plt
import pylustrator
pylustrator.start()

pylustrator.pickle_load('figObj.pickle') # interactive editing 

Looking forward to the future of pylustrator! Arash

arashgmn avatar Jul 31 '22 00:07 arashgmn

I am not sure if i want to recommend people using pickel files as they are not intended for long term storage as the serialisation can change between python versions. But I can have a look if it is possible to implemented such a feature for pylustrator. And yes in general it would be great to have a good format to save matplotlib figures.

rgerum avatar Jul 31 '22 01:07 rgerum

With this commit you should be able to start pylustrator after figure generation. Which means you should be able to load your figure from pickle first and then start pylustrator. You can install the repository version with

pip install git+https://github.com/rgerum/pylustrator

rgerum avatar Aug 18 '22 21:08 rgerum