![]() |
VOOZH | about |
Matplotlib is a library in Python. It is a mathematical extension of the Numpy Library. It is a comprehensive library for creating static, animated, and interactive visualizations in Python. Pyplot is a state-based interface to a Matplotlib module. The Pyplot can create many types of plots such as line graphs, bar graphs, histograms, etc. The cla(), clf() and close() are different methods and functions of Matplotlib.
This cla()method in the Pyplot module of the Matplotlib library is used to clear the current axes.
Output:
The clf() method in the Pyplot module of the Matplotlib library is used to clear the entire current figure. It even clears the subplot. It leaves the window space open so that it can be reused by other plots.
Output:
The close() method in the Pyplot module of the Matplotlib library is used to close the window of the plot. By default, it closes the current window. Since the window is closed there will no output in this method.
| cla() | clf() | close() |
|---|---|---|
| Used to clear the current axes | Used to clear the entire current figure | Used to close the window of the plot |
| It only clears the currently active plot | Leaves the window space open so that it can be reused by other plots | Terminates the plot completely |
| Doesn't affect any other subplot | It even clears the subplot. | Closes the plots entirely |