Matplotlib.figure.Figure.draw() in Python
Last Updated :
30 Apr, 2020
Improve
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
The draw() method figure module of matplotlib library is used to render the figure using matplotlib.backend_bases.RendererBase instance renderer.
Python3
Output:
Example 2:
Python3
Output:
matplotlib.figure.Figure.draw() function
Syntax: draw(self, renderer) Parameters: This accept the following parameters that are described below:Below examples illustrate the matplotlib.figure.Figure.draw() function in matplotlib.figure: Example 1:Returns: This method does not return any value.
- renderer: This parameter is the matplotlib.backend_bases.RendererBase instance renderer.
# 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
fig.draw(renderer)
tellme('matplotlib.figure.Figure.draw() \
function Example')
plt.show()

# 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
fig.draw(renderer)
plt.pause(.001)
fig.suptitle('matplotlib.figure.Figure.draw() \
function Example')
