Skip to content

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

Closed

Description

@jenshnielsen

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

Activity

  1. added this to the milestone on Jan 29, 2016
  2. jenshnielsen commented on Jan 29, 2016

    @jenshnielsen
    MemberAuthor

    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

  3. 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)[/+] on Jan 29, 2016
  4. jenshnielsen commented on Jan 29, 2016

    @jenshnielsen
    MemberAuthor

    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.

  5. mdboom commented on Jan 29, 2016

    @mdboom
    Member

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

  6. jenshnielsen commented on Jan 29, 2016

    @jenshnielsen
    MemberAuthor

    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

  7. efiring commented on Jan 29, 2016

    @efiring
    Member

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

  8. mdboom commented on Jan 29, 2016

    @mdboom
    Member

    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.

  9. added a commit that references this issue on Mar 7, 2016
    98c0c1b
  10. 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[/+] on Mar 28, 2016
  11. jenshnielsen commented on Apr 25, 2016

    @jenshnielsen
    MemberAuthor

    closed by #6290

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions