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
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
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