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.
The close() function in pyplot module of matplotlib library is used to close a figure window.
Parameters: This method accept only one parameters.
fig : This parameter accepts the following values:
- None: This value will close the current figure
- Figure: This value will close the given Figure instance
- int: This value will close a figure number
- str: This value will close a figure name
- ‘all’:This value will close all figures
Returns: This method does not returns any values.
Below examples illustrate the matplotlib.pyplot.close() function in matplotlib.pyplot:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course