Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The
Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
matplotlib.axes.Axes.draw() Function
The
Axes.draw() function in axes module of matplotlib library is used to draw everything.
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.
Below examples illustrate the matplotlib.axes.Axes.draw() function in matplotlib.axes:
Example 1:Python3# Implementation of matplotlib functionfrommpl_toolkits.mplot3dimportaxes3dimportmatplotlib.pyplotaspltfig,ax=plt.subplots()deftellme(s):ax.set_title(s,fontsize=16)fig.canvas.draw()renderer=fig.canvas.rendererax.draw(renderer)tellme('matplotlib.axes.Axes.draw() function Example')plt.show()
Output:
Example 2:Python3# Implementation of matplotlib functionfrommpl_toolkits.mplot3dimportaxes3dimportmatplotlib.pyplotaspltfig=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)forangleinrange(0,90):ax.view_init(30,angle)fig.canvas.draw()renderer=fig.canvas.rendererax.draw(renderer)plt.pause(.001)ax.set_title('matplotlib.axes.Axes.draw()\ function Example',fontweight="bold")
Output: