Is there a way to get the parent canvas for the axes in matplotlib?

I am working with matplotlib to create a very simple GUI around a statistical model / simulation. I would like to add a timer to this view so that some animation can be used. Problem: As my objects are set up, I have easy access to MPL axis objects but not quotes.

Is there a way to get the get parent canvas for the axes in matplotlib? This seems like the easiest way to fix this problem.

Alternatively, is there an obvious workaround? I am new to matplotlib.

+3


source to share


1 answer


It's simple ax.figure.canvas

.

eg.



import matplotlib.pyplot as plt
ax = plt.gca()

canvas = ax.figure.canvas 

      

+8


source







All Articles