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]: mpl.style.context() stops plotting inline in Jupyter #26716

Open
@iainAtIon

Description

@iainAtIon

Bug summary

Under certain circumstances, when using matplotlib.style.context() to temporarily alter the default style in a Jupyter notebook, it resets the backend to no plot inline. This occurs if the plot is the first one in the notebook, but not if another plot (without the context manager) has already been plotted.

Code for reproduction

# CASE 1:# first cell - produces inline plot with desired gridimportmatplotlibl.pyplotasplwithplt.style.context({'axes.grid':True}):plt.plot(range(10))# second cell - does not produce in line plotplt.plot(range(10))# CASE 2:# first cell - produces inline plotimportmatplotlibl.pyplotaspltplt.plot(range(10))# second cell - produces inline plot with desired gridwithplt.style.context({'axes.grid':True}):plt.plot(range(10))# third cell - produces in line plotplt.plot(range(10))

Actual outcome

CASE 1:
image

CASE 2:
image

Expected outcome

In case 1, the second plot should be inline

Additional information

No response

Operating system

Windows 10.0.19045 Build 19045

Matplotlib Version

3.7.2

Matplotlib Backend

'module://matplotlib_inline.backend_inline'

Python version

3.10.10

Jupyter version

6.4.12

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