Skip to content
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

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

Closed
mdboom opened this issue Nov 6, 2015 · 7 comments
Closed
Milestone

Comments

@mdboom
Copy link
Member

mdboom commented Nov 6, 2015

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

@mdboom mdboom added this to the next major release (2.0) milestone Nov 6, 2015
@WeatherGod
Copy link
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.

@mdboom
Copy link
Member Author

mdboom commented Nov 6, 2015

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?

@WeatherGod
Copy link
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)
.

@mdboom
Copy link
Member Author

mdboom commented Nov 6, 2015

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

@jenshnielsen
Copy link
Member

@efiring
Copy link
Member

efiring commented Nov 6, 2015

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.

@pelson
Copy link
Member

pelson commented Nov 8, 2015

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.

mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 9, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 11, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 16, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 16, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 17, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 23, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 25, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Nov 27, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 14, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 14, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 14, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 17, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 31, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Dec 31, 2015
mdboom added a commit to mdboom/matplotlib that referenced this issue Jan 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants