Matplotlib是Python中的一個庫,它是數字的-NumPy庫的數學擴展。 Pyplot是Matplotlib模塊的基於狀態的接口,該模塊提供了MATLAB-like接口。可在Pyplot中使用的各種圖線圖,輪廓圖,直方圖,散點圖,3D圖等。
matplotlib.pyplot.get_current_fig_manager()方法
matplotlib庫的pyplot模塊中的get_current_fig_manager()方法用於獲取當前圖形的圖形管理器。
用法:matplotlib.pyplot.get_current_fig_manager()
參數:此方法不接受任何參數。
返回:此方法返回當前圖形的圖形管理器。
以下示例說明了matplotlib.pyplot中的matplotlib.pyplot.get_current_fig_manager()函數:
範例1:
# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
X = np.arange(-10, 10, 0.5)
Y = np.arange(-10, 10, 0.5)
U, V = np.meshgrid(X, Y)
fig, ax = plt.subplots()
ax.quiver(X, Y, U, V)
ax.invert_xaxis()
w = plt.get_current_fig_manager()
print("Value Return by get_current_fig_manager():")
print(w)
fig.suptitle('matplotlib.pyplot.get_current_fig_manager() \
function Example', fontweight ="bold")
plt.show()
輸出:
Value Return by get_current_fig_manager():
<matplotlib.backends._backend_tk.FigureManagerTk object at 0x07BE6470>
範例2:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
xx = np.random.rand(16, 30)
fig, ax = plt.subplots()
m = ax.pcolor(xx)
m.set_zorder(-20)
w = plt.get_current_fig_manager()
print("Value Return by get_current_fig_manager():")
print(w)
fig.suptitle('matplotlib.pyplot.get_current_fig_manager()\
function Example', fontweight ="bold")
plt.show()
輸出:
Value Return by get_current_fig_manager():
<matplotlib.backends._backend_tk.FigureManagerTk object at 0x08725490>
注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 Matplotlib.pyplot.get_current_fig_manager() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。