Reputation: 20076
If I have an AxesSubplot
object, how can I obtain the window size of the plot? I can use get_xlim()
, but this returns a value in reference to the axis labels. I'd like to get the size of the plot in window terms for Tkinter purposes.
fig = getFig()
w = fig.?
h = fig.?
# will be used in conjunction with Tkinter window values
sw = window.winfo_screenwidth()
sh = window.winfo_screenheight()
Upvotes: 0
Views: 149
Reputation: 28302
I think what you probably want is to use the Figure class to handle this. You need to create a figure and then get your AxesSubplot out of it. Something like:
from matplotlib import pyplot
fig = pyplot.figure()
axes = fig.add_subplot(1,1,1)
w = fig.get_figwidth()
h = fig.get_figwidth()
get_figwidth and get_figheight
Upvotes: 1