The Python Oracle

When to use cla(), clf() or close() for clearing a plot in matplotlib?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Peaceful Mind

--

Chapters
00:00 Question
00:26 Accepted answer (Score 891)
02:57 Answer 2 (Score 110)
04:34 Answer 3 (Score 21)
05:06 Thank you

--

Full question
https://stackoverflow.com/questions/8213...

Accepted answer links:
[matplotlib.pyplot]: https://matplotlib.org/stable/api/_as_ge...
[plt.cla()]: https://matplotlib.org/stable/api/_as_ge...
[plt.clf()]: https://matplotlib.org/stable/api/_as_ge...
[plt.close()]: https://matplotlib.org/stable/api/_as_ge...
[fig.clf()]: https://matplotlib.org/stable/api/figure...

Answer 2 links:
[Create a figure that is reference counted]: https://stackoverflow.com/questions/1633...

Answer 3 links:
[Matplotlib, Pyplot, Pylab etc: What's the difference between these and when to use each?]: http://queirozf.com/entries/matplotlib-p...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #matplotlib #plot

#avk47