I want to save matplotlib figures as pickle, to enable my team to easily load them and investigate anomalous events. Using a simple image format loses the ability to zoom-in and investigate the figure. So I tried to pickle my figure:
fig, axarr = plt.subplots(2, sharex='all') # creating the figure
... # plotting things
...
pickle.dump(fig, open('myfigfile.p'), 'wb'))
Then I load it. Looks good. At first.
fig = pickle.load(open('myfigfile.p', 'rb'))
plt.show()
But then I see that sharex doesn't work. When I zoom-in on one subplot, the other remains static. On the original plot this works great, and zooming-in zooms on both x-axis, but after I pickle-load the figure, this doesn't work anymore. How can I save the plot so that it continues to share-x after loading? Or, how can I reinstate share-x after loading the figure from the pickle?
Thanks!