Matplotlib是Python中的一個庫,它是數字的-NumPy庫的數學擴展。 Pyplot是Matplotlib模塊的基於狀態的接口,該模塊提供了MATLAB-like接口。
matplotlib.pyplot.ioff()函數:
matplotlib庫的pyplot模塊中的ioff()函數用於關閉交互模式。
用法: matplotlib.pyplot.ioff()
參數:此方法不接受任何參數。
返回:此方法不返回任何值。
以下示例說明了matplotlib.pyplot中的matplotlib.pyplot.ioff()函數:
範例1:
# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
plt.ioff()
plt.plot([1.4, 2.5, 0.3])
axes = plt.gca()
axes.plot([3.1, 2.2, 6])
plt.title('matplotlib.pyplot.ioff() function Example',
fontweight ="bold")
plt.show()
輸出:
範例2:
# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
plt.ioff()
random_array = np.arange(-2, 4)
line_1 = random_array * 2
line_2 = 10 / (random_array * 2 + 1)
figure, axes = plt.subplots()
axes.plot(random_array, line_1,
'ro-', random_array,
line_2, 'bo-',
linestyle ='solid')
axes.fill_between(random_array,
line_1,
line_2,
where = line_2>line_1,
interpolate = True,
color ='green', alpha = 0.4)
lgnd = axes.legend(['line-1',
'line-2'],
loc ='lower center',
shadow = True)
lgnd.get_frame().set_facecolor('# ffb19a')
plt.title('matplotlib.pyplot.ioff() function Example',
fontweight ="bold")
plt.show()
輸出:
相關用法
注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 matplotlib.pyplot.ioff() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。