Skip to content

Figures in the notebook backend are too large following DPI changes #5945

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

Closed
jenshnielsen opened this issue Jan 29, 2016 · 7 comments
Closed
Milestone

Comments

@jenshnielsen
Copy link
Member

The changes to the figure dpi in a903315 makes the figure in the notebook backend larger and more fuzzy. Presumably because the size of the figure is not set correctly in the nbagg backend and the figure ends up being rescaled to the same default display dpi

Edit:

The actual issue is just that the figures are now larger because we increased the DPI.
The actual figure size in the notebook is in pixels so that the figure size in pixels will be dpi * figsize_in_inches exactly as is should be however the figure is subjectively to large

@jenshnielsen jenshnielsen added this to the 2.0 (style change major release) milestone Jan 29, 2016
@jenshnielsen
Copy link
Member Author

On 1.5.1
screen shot 2016-01-29 at 15 14 45

On 2.x

screen shot 2016-01-29 at 15 13 51

I bisected the change to a903315 as indicated above

@jenshnielsen jenshnielsen changed the title Changes to figure dpi are not suitable for the notebook backend Figure size in notebook backend depends on DPI (Changes to figure dpi are not suitable for the notebook backend) Jan 29, 2016
@jenshnielsen
Copy link
Member Author

Thinking a bit more about this it seems like the issue is that the figure size depends on the DPI of the image generated which is should not.

@mdboom
Copy link
Member

mdboom commented Jan 29, 2016

I'm not seeing the fuzzyness in the second image. One would expect the image to be larger when increasing the DPI -- since figure size comes not from the notebook, but from a hard coded default in inches from matplotlibrc.

That said, I think we need to get better about communicating the best size from the notebook to matplotlib, which would resolve this issue. I don't recall if that's one of the things fixed by #5754 or not...

@jenshnielsen
Copy link
Member Author

You are right of cause. The only thing that determines the figure size on screen is the number of pixels in the png which grows with dpi change.

That being said I still think the default figure size is way to large for the notebook now.

And I still see the fuzzyness.

Compare

1.5.1

matplotlib 151

2.x

matplotlib 2x

2.x with dpi 80

matplotlib 2x dpi80

I have scaled the figure size in these examples to create a figure with both the old and the new size by multiplying with 10/8 and 8/10 respectively

@efiring
Copy link
Member

efiring commented Jan 29, 2016

Is it possible for the notebook backend to ask the browser what it thinks the actual screen dpi is?

@mdboom
Copy link
Member

mdboom commented Jan 29, 2016

I don't think so -- the best you get is whether the browser is in "retina mode" (scaling) or not. But you can get the width of the cell, or the width of the document frame, which while not the same thing would allow us to shrink the figure accordingly to fit.

mdboom added a commit to mdboom/matplotlib that referenced this issue Mar 7, 2016
to something smaller that fits in the webbrowser well
@jenshnielsen jenshnielsen changed the title Figure size in notebook backend depends on DPI (Changes to figure dpi are not suitable for the notebook backend) Figures in the notebook backend are too large following DPI changes Mar 28, 2016
@jenshnielsen
Copy link
Member Author

closed by #6290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants