I need to handle the pyplot objects, like figures and axes. Here is a simplified example of what I want:
In [1]: import matplotlib.pyplot as mp
In [2]: fig = mp.figure() # create a figure
In [3]: mp.show() # and immediately show it. And close.
In [4]: ax = fig.add_subplot(111) # Then I create a plot on that figure
In [5]: ax.plot([1, 2, 3])
Out[5]: [<matplotlib.lines.Line2D at 0x104e29a50>]
In [6]: mp.get_fignums() # But I already released the figure, so it doesn't appear in the list of available figures
Out[6]: []
In [7]: fig.axes[0].lines[0].get_data() # The data is there, on the plot
Out[7]: (array([ 0., 1., 2.]), array([1, 2, 3]))
In [8]: mp.show() # But mp.show() shows nothing.
The fig.show() doesn't work too. How to show a figure after releasing it?
UPD: There was a similar question: Matplotlib: re-open a closed figure?, but with no answer.