Python中的 Matplotlib.axes.Axes.draw()
Matplotlib是Python中的一个库,它是 NumPy 库的数值数学扩展。 Axes 类包含大部分图形元素:Axis、Tick、Line2D、Text、Polygon 等,并设置坐标系。 Axes 的实例通过回调属性支持回调。
matplotlib.axes.Axes.draw()函数
matplotlib 库的 axes 模块中的Axes.draw()函数用于绘制所有内容。
Syntax: Axes.draw(self, renderer=None, inframe=False)
Parameters: This method accepts the following parameters.
- renderer: This parameter is the first parameter and its default value is None.
- inframe: This parameter contains the boolean value and its default value is false.
Returns: This method does not return any value.
下面的示例说明了 matplotlib.axes 中的 matplotlib.axes.Axes.draw()函数:
示例 1:
# Implementation of matplotlib function
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
def tellme(s):
ax.set_title(s, fontsize = 16)
fig.canvas.draw()
renderer = fig.canvas.renderer
ax.draw(renderer)
tellme('matplotlib.axes.Axes.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, 90):
ax.view_init(30, angle)
fig.canvas.draw()
renderer = fig.canvas.renderer
ax.draw(renderer)
plt.pause(.001)
ax.set_title('matplotlib.axes.Axes.draw()\
function Example', fontweight ="bold")
输出: