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
Weirdness with inline figure DPI settings in Jupyter Notebook #9217
Comments
Any reason to not use |
attn @Carreau |
Yes, the inline backend has different rcParam (historically) we should likely revisit those now that there is matplotlib 2; Screen resolution has also evolved quite a bit since we added that. I guess the "Correct" way to do it would be to have a notebook style, and activate that style when doing inline.
I'm pretty sure there is already an issue with that, but I could not find it, so I opened ipython/ipykernel#267 |
Thanks for looking into this. I can see why the IPython inline backend rc param over-ride is causing the second part of my original issue. Per this SO thread, this can be addressed by setting However, re the first part of my original issue, is there any reason that the EDIT: I don't get this behaviour in the IPython console: In [1]: import matplotlib as mpl
In [2]: mpl.rcParams['figure.dpi']
Out[2]: 100.0
In [3]: import matplotlib.pyplot as plt
In [4]: mpl.rcParams['figure.dpi']
Out[4]: 100.0 |
I also just noticed that this difference in DPI apparently has grown since MPL 2.x. But why is even the shape of the plot different? |
I'm also affected by the first part of the problem after updating matplotlib and Jupyter today (happened after updating Jupyter), and would like to know how to disable this. I'm working around it for now by downgrading to ipykernel 4.6.1. |
I too find too small the matplotlib figures created in jupyter. |
@vnoel This is the issue tracker of matplotlib. You would mostly not find answers to problems here, but rather ideas to improve things in the future. This is also more related to ipykernel than matplotlib. The basic idea of how to change the default figure settings is to change them in the |
Having the The work-around solution is to keep the two commands in two separate cells and run the cell with |
Closing this in lieu of ipython/ipykernel#267. If there is any action to take here on matplotlib's side, please (request to) reopen. |
Could the magic function just no override the rc settings. |
Just FYI, ipython/ipykernel#267 is now resolved with |
What about |
It may be that this is the intended behavior. We nowadays defer backend selection until the first plot. If the activated backend manipulates rcParams, this is obviously deferred as well. You can explicitly select the backend through https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.use. |
Updating |
I find the default inline plotting DPI (72) of figures in Jupyter too small and would like to plot inline figures at 100 by default. However, the (i) import of pyplot and (ii) use of %matplotlib inline both seem to override the figure.dpi setting of 100 I have put in my .matplotlibrc file. I can address this issue by using mpl.rcParams['figure.dpi'] = 100 after importing pyplot and running %matplotlib inline, but think it would be better if this was not required every time.
I'm not sure if this is an issue with matplotlib, Jupyter Notebook and/or ipykernel.
Any assistance appreciated.
Issue 1: Import of pyplot overrides figure.dpi in .matplotlibrc
Issue 2: Use of %matplotlib inline magic overrides figure.dpi in .matplotlibrc
Matplotlib version
The text was updated successfully, but these errors were encountered: