Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
Frommatplotlib/ipympl#405 it seems that if you repreatedly run a cell withplt.figure(num=1)
and then plot a new line you will only ever have a plot with one line on it.
Code for reproduction
Cell 1
%matplotlibnbaggimportnumpyasnpimportmatplotlib.pyplotaspltx=np.linspace(-np.pi/2,np.pi/2)i=0
Cell 2 (run this one repeatedly)
plt.figure(num=1)plt.plot(x,np.sin(x*i))i+=1
Actual outcome
Expected outcome
Do the equivalent from ipython:
importmatplotlib.pyplotaspltimportnumpyasnpplt.ion()x=np.linspace(-np.pi/2,np.pi/2)# each iteration of loop represents a cell re-executioni=0defrun_cell():globaliplt.figure(num=1)plt.plot(x,np.sin(x*i))i+=1
Additional information
No response
Operating system
No response
Matplotlib Version
3.5.1
Matplotlib Backend
nbagg
Python version
3.9.7
Jupyter version
6.4.4
Installation
pip