ipympl
ipympl copied to clipboard
Default toolbar overlaps figure
Describe the issue
The default position of the toolbar is on the left, where it overlaps the figure.
Especially when the constrained_layout=True keyword is used when creating the figure,
this is highly undesirable.
Possible solutions or workarounds:
- Minimal fix: Change the default to anything other then "left"; I think that with the current design, "right" would be by far the best. It would minimize the likelihood of an overlap.
- The real fix: When the toolbar_position is on the left, position the figure to its right. Ideally, all toolbar positions should be in boxes that never overlap the figure box. With this scheme I suggest putting the default toolbar on the top or bottom, and flush left, to match all of the other matplotlib interactive backends.
Versions
3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:06:49)
[Clang 12.0.1 ]
ipympl version: 0.9.2
Selected Jupyter core packages...
IPython : 8.5.0
ipykernel : 6.16.0
ipywidgets : 7.7.0
jupyter_client : 7.3.5
jupyter_core : 4.11.1
jupyter_server : 1.23.1
jupyterlab : 3.5.0
nbclient : 0.6.8
nbconvert : 7.0.0
nbformat : 5.6.1
notebook : 6.5.2
qtconsole : 5.3.1
traitlets : 5.4.0
Known nbextensions:
config dir: /Users/efiring/.jupyter/nbconfig
notebook section
matplotlib/extension enabled
- Validating: problems found:
- require? X matplotlib/extension
config dir: /Users/efiring/miniconda3/envs/py38/etc/jupyter/nbconfig
notebook section
jupyter-matplotlib/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
JupyterLab v3.5.0
/Users/efiring/miniconda3/envs/py38/share/jupyter/labextensions
jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
jupyter-matplotlib v0.11.2 enabled OK
@jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets)
I'm puzzled: the example in the README.md, https://github.com/matplotlib/ipympl/blob/main/matplotlib.gif, behaves the way I want, with the toolbar on the left but not overlapping the figure boundary. Has the behavior gotten broken since that animated gif was made?
😅 Indeed the behavior changed since the README GIF was generated.
The decision was made to overlap the figure when we went for a "hide and show" toolbar. Though indeed it could be nice to be able to control this behavior.
As a data point from one person: I see no advantages whatsoever in "hide and show". It is simply distracting, and a step back from discoverability and what-you-see-is-what-you-get. I think that the old notebook backend provides a fine model of good behavior, very similar to all the other GUI backends. The toolbar is there, below the figure, when the figure is active; and there is a "close" button to freeze the figure, close it on the matplotlib side, and remove the toolbar.
I'm sorry I wasn't paying attention whenever the decision was made to add "hide-and-show". I hope its reversal can be considered. Surely it is not helping anyone's productivity, is it?
This behavior was introduced to increase the available space for the figure.
I'd be happy to help reviewing a PR that allows optionally putting the toolbar outside of the figure.
I think this is undocumented (:cry: ) but the fade out is configurable via the fig.cavnas.toolbar_visible attribute.
Notably, like other things in ipympl there is no equivalent of rcparams wherein the user can configure this permanently.
Is there any reason that the toolbar cannot go in the status gutter to the left of the figure? At least on my notebooks there is lots of extra space.