-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Make %matplotlib inline side effect free #10383
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
Thanks for the issue. I believe that we have another issue opened for that but I can't find it. In particular IIRC, the background color and default size if we don't change them are problematic. |
Please remove this behavior of overriding the settings in matplotlibrc. I understand that the (ugly) matplotlib defaults cause problems out of the box. However, I think the current behavior is extremely confusing for new users trying to change these defaults. For users who do not understand that These default settings also seem to produce figures that are too small for modern monitors. A dpi of 72 times a 4.0" height produces a figure less than 300 pixels high, which is a quarter the height of a 1920 x 1200 monitor, but figures rendered with these defaults always seem significantly smaller than this. I remember that in past years a line like Possible compromise: overwrite rc settings only if the current matplotlibrc file is not in the config directory, using Thanks for your time. |
I completely agree that we should now revert this behavior in So if a user wants to set some rcParams at the top of their file, they basically get overridden on first plot call. They have to go back and rerun that first cell again for their changes to take, for no comprehensible reason. I just spent a good 1/2 hour debugging this just now, even though I know I was one of the people who wrote that code years ago! :) I think we should fall back to being as hands-off as possible now, and leave this configuration to mpl/the users. We made those choices for good reason early on when the notebook was very new (I actually think we started that with the Qt console), but now I think it causes more confusion than good. I think we should revert our overrides, and let folks make their fine-tuning as they wish, using standard mechanisms. My vote would be to drop all our overrides here and leave things clean (note that code now lives in the separate I ran some quick tests manually restoring the values we override, and things seem to work fine. |
That's reasonable, we could provide a matplotlib notebook "style" for backward compat. |
👍 I have a few min in between meetings, let me whip up a PR real quick :) |
Oops!!! Sorry - I was being lazy and used the in-browser code editor ( I quickly force-pushed to revert, and will make a PR next. Serves me well! 🤦 |
OK, now it's there, properly made. I have never touched that repo, so LMK if you'd like a bit of doc update too, happy to do it. gotta run now... |
Remove matplotlib rc overrides. Addresses: - ipython/ipython#10383 - matplotlib/matplotlib#23007
It's been a few months since this issue was fixed. If anyone here is also a maintainer on matplotlib-inline, could you publish an updated version? |
@davidnero - see here where we're discussing indeed making a release. I'm volunteering for it b/c I need this before I start teaching! Should happen soon. |
I'm going to close this as the real issue is in the matplotlib-inline repo, fixed and only pending release of a new version. |
Currently matplotlib inline sets a number of rc parameters. If you naively assume (as I did until recently) that it simply instructs the notebook to show plots inline, this can lead to bugs overwriting earlier defined rc settings. With the stylesheet support that matplotlib now has it might be better to separate the backend choice from loading a style sheet that looks nice in the notebook.
I raised the issue with Fernando on Twitter who encouraged me to propose PR. I am posting it here to solicit more feedback before moving forward.
The text was updated successfully, but these errors were encountered: