Is it possible to dump the matplotlib plot in Pickle using the default figure manager and load it in Jupyter notebook.
Basically I tried now to save a plot by running a .py file
`
import numpy as np
import matplotlib.pyplot as plt
import pickle
x = np.linspace(-np.pi, np.pi)
y = np.cos(x)
fig, ax = plt.subplots(1, 1)
ax.plot(x, y, label=‘cos(x)’)
ax.set_xlabel(‘Time (s)’)
That code works for me. I suspect your output and input versions of Matplotlib are different - the pickle objects are not portable across version changes of Matplotlib.
I’m personally pretty against pickling figures. Usually it’s just as well to save the data and re-plot. However I can see the use if you have made a bunch of manual changes.