VOOZH about

URL: https://www.geeksforgeeks.org/python/matplotlib-pyplot-clf-in-python/

⇱ Matplotlib.pyplot.clf() in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Matplotlib.pyplot.clf() in Python

Last Updated : 12 Jul, 2025

Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
 

matplotlib.pyplot.clf() Function


The clf() function in pyplot module of matplotlib library is used to clear the current figure. 
Syntax: 
 

matplotlib.pyplot.clf()


Below examples illustrate the matplotlib.pyplot.clf() function in matplotlib.pyplot:
Example 1: 
 

Output: 
 

👁 Image


Example 2: 
 

Output: 
Before using clf() function 
 

👁 Image


After using clf() function 
 

👁 Image


 

Comment
Article Tags: