ipympl icon indicating copy to clipboard operation
ipympl copied to clipboard

Documentation: Flags to set notebook-wide default behavior

Open gsaurabhr opened this issue 4 years ago • 10 comments

This is a continuation of the enhancement fixed with #134 . The fix in #134 allows hiding the figure headers by setting a figure-specific flag:

f = plt.figure()
f.canvas.header_visible = False

A further enhancement would be to not have to do this for every figure, but set the default behavior via a global flag, for example, something similar to mpl.rcParams for ipympl. This could potentially be useful for other global behaviors of the package.

gsaurabhr avatar May 20 '20 22:05 gsaurabhr

One thing I realized today is that you can actually do it, thanks to traitlets.

You can do:

from ipympl.backend_nbagg import Canvas

Canvas.header_visible.default_value = False

martinRenou avatar May 25 '20 07:05 martinRenou

Perfect, thank you, that works!

gsaurabhr avatar May 26 '20 18:05 gsaurabhr

Sure :) Let's keep your issue opened until this is properly documented somewhere

martinRenou avatar May 27 '20 07:05 martinRenou

Just wanted to link this to #208.

gsaurabhr avatar May 29 '20 17:05 gsaurabhr

Thanks, this really need to be done. I'll try to take some time to do it at some point.

martinRenou avatar May 29 '20 18:05 martinRenou

You can do:

from ipympl.backend_nbagg import Canvas
Canvas.header_visible.default_value = False

Any solution for Jupyter Lab as nbagg does not work there?

mlt avatar Mar 01 '23 04:03 mlt

Any solution for Jupyter Lab as nbagg does not work there?

The quoted code will work in either jupyter lab or jupyter notebook. The name backend_nbagg is a relic of where the ipympl code came from

ianhi avatar Mar 01 '23 05:03 ianhi

Nope... image Do I drop it at the wrong place??

mlt avatar Mar 01 '23 06:03 mlt

huh - indeed that doesn't seem to work - I wonder if some update must've broken it along the way.

I suspect in this case that there is a conflict between the typescript defaults and the python defaults of these traits and somehow the typescript side is winning.

ianhi avatar Mar 01 '23 19:03 ianhi

Is the notebook-wide flag going to be fixed for Jupyter Lab?

s-bien avatar Aug 18 '23 16:08 s-bien