-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
backend partially ignores "figure.figsize" in plt.rc_context in jupyter #23513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I suspect that this is fixed by ipython/matplotlib-inline#14 The interaction here is:
Due to the delayed import matplotlib-inline is now imported inside of the context manager which overrides your values (and which the context sets back to what it was before on exit which hides the state change!). The call to Adding I am going to close this issue because we understand it and a fix has been merged downstream. Sorry we broke this on you. |
Thank you very much for the really quick and insightful answer. However, when I put |
One day I will learn to always test my suggestions before suggesting.... I (incorrectly) thought that you would be going through the backend fallback logic so checking the would do import the backend module, but there is actually a string already set so Instead doing:
will definitely import the module and trigger the rcparam changing logic. |
There is still something fishy with this import.
You are probably referring to https://github.com/ipython/matplotlib-inline/blob/f764b4354b2358aa001471215494d7dfdc505593/matplotlib_inline/backend_inline.py#L227 However, somewhere in the machinery the module already got imported, which then hinders the re-execution of
However, explicitly importing it into a new namespace works:
|
I did not learn my lesson about testing in the post where I noted needing to learn my lesson about testing 🤦🏻 |
Bug summary
This possibly related to #20738
When I run the code below on a new jupyter kernel, only the tick styling is working. The
figure.size
andfigure.dpi
is ignored first.One has to run something interacting with the backend first (like
matplotlib.pyplot.show()
) in order to getplt.rc_context()
working correctly.Is this normal behavior, since the correct backend already seems to be activated or did I oversee something?
Code for reproduction
Actual outcome
Expected outcome
Runnig the code twice, which has then

plt.show()
already called once delivers the correct output:Additional information
No response
Operating system
No response
Matplotlib Version
3.5.2
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
Python 3.9.7
Jupyter version
6.4.12
Installation
No response
The text was updated successfully, but these errors were encountered: