Matplotlib是Python中的一個庫,它是數字的-NumPy庫的數學擴展。 Pyplot是Matplotlib模塊的基於狀態的接口,該模塊提供了MATLAB-like接口。可在Pyplot中使用的各種圖線圖,輪廓圖,直方圖,散點圖,3D圖等。
matplotlib.pyplot.isinteractive()方法
matplotlib庫的pyplot模塊中的isinteractive()方法用於獲取是否在每個繪圖命令之後重繪。
用法:matplotlib.pyplot.isinteractive()
參數:此方法不接受任何參數。
返回:此方法返回是否在每個繪圖命令後重繪。
以下示例說明了matplotlib.pyplot中的matplotlib.pyplot.isinteractive()函數:
範例1:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 500)
y = np.sin(x**2)+np.cos(x)
plt.plot(x, y, label ='Line 1')
plt.plot(x, y - 0.6, label ='Line 2')
w = plt.isinteractive()
print("Is we can redraw after every plotting command:",
str(w))
plt.title('matplotlib.pyplot.isinteractive() function \
Example', fontweight ="bold")
plt.show()
輸出:
Is we can redraw after every plotting command: False
範例2:
# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.01, 5.0, 0.01)
s = np.exp(-t)
plt.plot(t, s)
plt.ylim(1, 0)
plt.ylabel('Display Y-axis Label', fontweight ='bold')
plt.grid(True)
w = plt.isinteractive()
print("Is we can redraw after every plotting command:",
str(w))
plt.title('matplotlib.pyplot.isinteractive() function \
Example', fontweight ="bold")
plt.show()
輸出:
Is we can redraw after every plotting command: False
注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 Matplotlib.pyplot.isinteractive() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。