Skip to content

Default setting of figure transparency in NbAgg is a performance problem #5419

Closed

Description

@mdboom

I missed the implications of #3552 when it went through.

If any part of the plot image is transparent, a full image frame is sent in order to make sure there isn't any ghosting. The default value of nbagg.transparent == True unfortunately means that full images are always sent for every frame. This results in lower framerates and flickering.

I can workaround this by setting figure.facecolor: white and nbagg.transparent: False, but I wonder if we shouldn't make this the default. 2.0 might be a good opportunity to make figure.facecolor: white the default for every backend anyway, which does generally look more modern.

It does mean it IPython ever changes their style to something on a non-white background things may not look as nice, but we'll cross that when we get there.

Cc: @pelson

Activity

  1. added this to the milestone on Nov 6, 2015
  2. WeatherGod commented on Nov 6, 2015

    @WeatherGod
    Member

    I think the reason why that setting was set that way was to match the
    appearance for the inline images. Quite honestly, I hate that, as it has
    bitten me multiple times when I copy an image over from a notebook to
    PowerPoint...

    On Fri, Nov 6, 2015 at 9:53 AM, Michael Droettboom <notifications@github.com

    wrote:

    I missed the implications of #3552
    #3552 when it went through.

    If any part of the plot image is transparent, a full image frame is sent
    in order to make sure there isn't any ghosting. The default value of nbagg.transparent
    == True unfortunately means that full images are always sent for every
    frame. This results in lower framerates and flickering.

    I can workaround this by setting figure.facecolor: white and nbagg.transparent:
    False, but I wonder if we shouldn't make this the default. 2.0 might be a
    good opportunity to make figure.facecolor: white the default for every
    backend anyway, which does generally look more modern.

    It does mean it IPython ever changes their style to something on a
    non-white background things may not look as nice, but we'll cross that when
    we get there.

    Cc: @pelson https://github.com/pelson

    —
    Reply to this email directly or view it on GitHub
    #5419.

  3. mdboom commented on Nov 6, 2015

    @mdboom
    MemberAuthor

    I think the reason why that setting was set that way was to match the
    appearance for the inline images.

    Ok -- that at least makes some sense. But wouldn't setting the background to white for inline images also be one way to fix that?

    Quite honestly, I hate that, as it has bitten me multiple times when I copy an image over from a notebook to PowerPoint...

    Meaning you hate that the inline images are transparent or vice versa?

  4. WeatherGod commented on Nov 6, 2015

    @WeatherGod
    Member

    Correct, setting the background to white for inline images would fix that,
    but isn't that handled by IPython? And yes, I hate transparent images in
    general.

    On Fri, Nov 6, 2015 at 10:33 AM, Michael Droettboom <
    notifications@github.com> wrote:

    I think the reason why that setting was set that way was to match the
    appearance for the inline images.

    Ok -- that at least makes some sense. But wouldn't setting the background
    to white for inline images also be one way to fix that?

    Quite honestly, I hate that, as it has bitten me multiple times when I
    copy an image over from a notebook to PowerPoint...

    Meaning you hate that the inline images are transparent or vice versa?

    —
    Reply to this email directly or view it on GitHub
    #5419 (comment)
    .

  5. mdboom commented on Nov 6, 2015

    @mdboom
    MemberAuthor

    Yes -- I think IPython sets the transparent background on inline images. We can always lobby them to stop if that makes sense... ;)

  6. jenshnielsen commented on Nov 6, 2015

    @jenshnielsen
    Member
  7. efiring commented on Nov 6, 2015

    @efiring
    Member

    This sounds related to a problem I just ran into with master, and with %matplotlib notebook: saving to a png with fig.savefig, I could not find a way to make the png figure background white instead of transparent. Has anyone else seen this? To get around it I had to switch to using %matplotlib inline.

  8. pelson commented on Nov 8, 2015

    @pelson
    Member

    If any part of the plot image is transparent, a full image frame is sent in order to make sure there isn't any ghosting.

    We could be more sophisticated with the solution - we could send over only the semi-transparent pixels as a separate message and clear those pixels before applying them on the JS side.

    Either way, I'm 👍 on producing white borders by default - for both nbagg and all other backends. I've disliked the fact that we have a savefig.transparent setting which changes how a figure looks between interactivity and savefig for some time, and this would go some way to fixing that.

  9. added 8 commits that reference this issue on Nov 9, 2015
    b3068dc
    9c3a100
    744a23f
    3b1e3c7
    6c2c7ab
    5c00bf0
    16ef7aa
    c152b12
  10. added 4 commits that reference this issue on Dec 14, 2015
    80341a8
    e07f515
    ba25a7f
    08d88e9
  11. added 3 commits that reference this issue on Dec 31, 2015
    fe071f1
    a412ffb
    8203f27
  12. added a commit that references this issue on Jan 25, 2016
    d2f6bea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions