2015-06-30 58 views
0

如果我有一個AxesSubplot對象,如何獲得圖的窗口大小?我可以使用get_xlim(),但是這會返回一個參考軸標籤的值。我希望以Tkinter爲目的的窗口大小來表示劇情的大小。matplot lib獲取子窗口的窗口大小

fig = getFig() 
w = fig.? 
h = fig.? 

# will be used in conjunction with Tkinter window values 
sw = window.winfo_screenwidth() 
sh = window.winfo_screenheight() 

回答

1

我想你可能想要的是使用Figure類來處理這個問題。你需要創建一個圖形,然後讓你的AxesSubplot離開它。喜歡的東西:

from matplotlib import pyplot 

fig = pyplot.figure() 
axes = fig.add_subplot(1,1,1) 
w = fig.get_figwidth() 
h = fig.get_figwidth() 

get_figwidthget_figheight