I have a number of subplots in a figure fig1
, created via
ax = fig1.add_subplot(221)
I then plot stuff in each of the subplots via
im=ax.plot(x,y)
and add some axis labels via
ax.set_xlabel('xlabel')
I would then like to clear a specific subplot completely, as described in When to use cla(), clf() or close() for clearing a plot in matplotlib?. However the problem is that ax.cla()
and ax.clear()
seem to only clear the data from the plot, without removing the axes, axis tick labels etc. On the other hand plt.clf()
clears the entire figure. Is there something in between? A clf-like command that clears everything in a subplot, including axis labels? Or have I simply used the commands in a wrong way?