I am using multiple matplotlib
figures to visualize data in a tkinter
application and so far that has been going great by using the explicit interface, i.e. by working on the axis objects.
Now I would like to save some figures to files. For this I can only find the pyplot function plt.savefig
which is using the pyplot
interface. Hence, since I have multiple figures I need to run
plt.figure(somefig)
to choose the figure I'd like to save. Unfortunately, this breaks in my usecase since I'm using FigureCanvasTkAgg
to get the canvas for tkinter
. As discribed in this bugreport, that call ruins the figure mangager so the call plt.figure(somefig)
results in the error
ValueError: The passed figure is not managed by pyplot
So I guess my question is: Is there a way to save a figure witout using the implicit pyplot
module?