Matplotlib.pyplot.clf() in Python Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4], [16, 4, 1, 8]) plt.clf() plt.title('matplotlib.pyplot.clf Example') plt.show() Output: Example 2: Python3 # Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt t = np.linspace(0.0, 2.0, 201) s = np.sin(2 * np.pi * t) plt.ylabel('y-axis') plt.xlabel('x-axis') plt.plot(t, s) plt.grid(True) plt.clf() plt.title('matplotlib.pyplot.clf Example') plt.show() Output: Before using clf() function After using clf() function Comment More infoAdvertise with us Next Article Matplotlib.pyplot.clim() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads Matplotlib.pyplot.cla() in Python 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, 1 min read Matplotlib.pyplot.gcf() in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.pyplot.gcf() matplotlib.pyplot.gcf() is primarily used to get the current fi 2 min read Matplotlib.pyplot.clim() in Python 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, 2 min read Matplotlib.pyplot.gca() in Python Matplotlib is a library in Python and it is a numerical - mathematical extension for the NumPy library. Pyplot is a state-based interface to a Matplotlib module that provides a MATLAB-like interface.  matplotlib.pyplot.gca() Function The gca() function in pyplot module of matplotlib library is used 2 min read Matplotlib.pyplot.gci() in Python 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, 2 min read matplotlib.pyplot.clabel() in Python Contour plots or Level plots are a way to display a three-dimensional surface on a two-dimensional plane. It graphs as contours as one output variable z and two predictor variables x and y on the y-axis. Often such contours are also known as z-slices.The clabel() method in mathplotlib.pyplot is used 4 min read Like