Matplotlib是Python中的一個庫,它是數字的-NumPy庫的數學擴展。 Pyplot是Matplotlib模塊的基於狀態的接口,該模塊提供了MATLAB-like接口。
matplotlib.pyplot.draw()函數
matplotlib庫的pyplot模塊中的draw()函數用於重繪當前圖形。
用法: matplotlib.pyplot.draw()
以下示例說明了matplotlib.pyplot中的matplotlib.pyplot.draw()函數:
範例1:
# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
def tellme(s):
plt.title(s, fontsize = 16)
plt.draw()
plt.clf()
plt.setp(plt.gca(), autoscale_on = False)
tellme('matplotlib.pyplot.draw() function Example')
plt.show()
輸出:
範例2:
# Implementation of matplotlib function
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection ='3d')
X, Y, Z = axes3d.get_test_data(0.1)
ax.plot_wireframe(X, Y, Z, rstride = 5,
cstride = 5)
for angle in range(0, 360):
ax.view_init(30, angle)
plt.draw()
plt.pause(.001)
ax.set_title('matplotlib.pyplot.draw()\
function Example', fontweight ="bold")
輸出:
相關用法
注:本文由純淨天空篩選整理自SHUBHAMSINGH10大神的英文原創作品 Matplotlib.pyplot.draw() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。