Saturday, July 4, 2026
HomeLanguagesMatplotlib.axes.Axes.redraw_in_frame() in Python

Matplotlib.axes.Axes.redraw_in_frame() in Python

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.redraw_in_frame() Function

The Axes.redraw_in_frame() function in axes module of matplotlib library is used to efficiently update Axes data.

Syntax: Axes.redraw_in_frame(self)

Parameters: This method does not accepts any parameters.

Returns: This method does not return any value.

Note: This method can only be used after an initial draw which caches the renderer.

Below examples illustrate the matplotlib.axes.Axes.redraw_in_frame() function in matplotlib.axes:

Example 1:




# Implementation of matplotlib function 
import matplotlib.pyplot as plt
  
  
fig, ax = plt.subplots() 
     
def tellme(s): 
    ax.set_title(s, fontsize = 12, fontweight ="bold"
    fig.canvas.draw()
    ax.redraw_in_frame()
      
tellme('matplotlib.axes.Axes.redraw_in_frame() function \
Example') 
  
plt.show() 


Output:

Example 2:




# Implementation of matplotlib function 
import matplotlib.pyplot as plt
import numpy as np
import time
  
  
fig, ax = plt.subplots()
line, = ax.plot(np.random.randn(100))
  
tstart = time.time()
num_plots = 0
fig.canvas.draw()
while time.time()-tstart < 5:
    line.set_ydata(np.random.randn(100))
    ax.redraw_in_frame()
    num_plots += 1
      
ax.set_title('matplotlib.axes.Axes.redraw_in_frame() \
function Example') 
  
plt.show() 


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32519 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6900 POSTS0 COMMENTS
Nicole Veronica
12015 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12110 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6967 POSTS0 COMMENTS