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

前端 未结 3 2093
北荒
北荒 2020-11-22 09:03

Matplotlib offers there functions:

cla()   # Clear axis
clf()   # Clear figure
close() # Close a figure window

The documentation doesn\'t o

3条回答
  •  故里飘歌
    2020-11-22 09:32

    plt.cla() means clear current axis

    plt.clf() means clear current figure

    also, there's plt.gca() (get current axis) and plt.gcf() (get current figure)

    Read more here: Matplotlib, Pyplot, Pylab etc: What's the difference between these and when to use each?

提交回复
热议问题