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

Documentation: Flags to set notebook-wide default behavior #229

Closed
gsaurabhr opened this issue May 20, 2020 · 10 comments
Closed

Documentation: Flags to set notebook-wide default behavior #229

gsaurabhr opened this issue May 20, 2020 · 10 comments

Comments

@gsaurabhr
Copy link

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.

@martinRenou
Copy link
Member

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

@gsaurabhr
Copy link
Author

Perfect, thank you, that works!

@martinRenou martinRenou changed the title Flags to set notebook-wide default behavior Documentation: Flags to set notebook-wide default behavior May 27, 2020
@martinRenou
Copy link
Member

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

@gsaurabhr
Copy link
Author

Just wanted to link this to #208.

@martinRenou
Copy link
Member

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

@mlt
Copy link

mlt commented Mar 1, 2023

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?

@ianhi
Copy link
Collaborator

ianhi commented Mar 1, 2023

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

@mlt
Copy link

mlt commented Mar 1, 2023

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

@ianhi
Copy link
Collaborator

ianhi commented Mar 1, 2023

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.

@s-bien
Copy link

s-bien commented Aug 18, 2023

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

@gsaurabhr gsaurabhr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
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