Ich muss die pyplot Objekte behandeln, wie Figuren und Achsen. Hier ist ein vereinfachtes Beispiel dessen, was ich will:Objektorientierte pyplot
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.
Die fig.show() funktioniert auch nicht. Wie zeige ich eine Figur nach der Veröffentlichung?
UPD: Es gab eine ähnliche Frage: Matplotlib: re-open a closed figure?, aber ohne Antwort.
Warum nicht einfach mit einem Arbeits 'matplotlib' Beispiel beginnen? – linusg
Ich würde mich freuen, ein Arbeitsbeispiel zu haben, wo gezeigt wird, wie man die freigesetzten Figuren abholt. – user3631854