Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Incorrect behavior in nbagg when callingplt.figure(num=1) #21957

Open
@ianhi

Description

@ianhi

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

nbagg-bug

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

correct-ipython

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp