plt.subplots()
does not remove existing subplots when called on existing figure
#6285
Labels
Milestone
When using
plt.subplots(..., num=101)
with explicit figure numbernum
-parameter,the figure window does not get cleared before the new subplots are created. This can be seen by running the following code fragment:
The second
plt.subplots()
-call produces 4 new empty subplots above the old ones. I am not sure if this is the intended behavior, but I think removing existing subplots first would be more intuitive. Alternatively, adding a booleanclf=False
keyword to theplt.figure()
function would be even more useful and would not change the default behavior.Thanks.
PS: This issue came up, when doing interactive data exploration in Sypder/IPython with the following work flow:
For this use case the
subplots()
command is quite unsuitable in my opinion, because the figure needs to be for explicitly cleared first.PPS: Tested on Debian/Sid with Python 3.5.1 and Matplotlib 1.5.1-1+b2
The text was updated successfully, but these errors were encountered: