matplotlib / ipympl

Matplotlib Jupyter Integration
https://matplotlib.org/ipympl/
BSD 3-Clause "New" or "Revised" License
1.59k stars 225 forks source link

Documentation: README disagrees with https://matplotlib.org/ipympl/ #454

Open blthayer opened 2 years ago

blthayer commented 2 years ago

Describe the issue

The current README specifies that to use ipympl you simply use the following magic:

%matplotlib widget

However, the documentation specifies the following magic:

%matplotlib ipympl

The latter works for my system, while the former does not.

Versions

 3.10.3 (main, Mar 18 2022, 08:05:10) [GCC 9.4.0]
ipympl version: 0.8.8
Selected Jupyter core packages...
IPython          : 8.2.0
ipykernel        : 6.12.1
ipywidgets       : 7.7.0
jupyter_client   : 7.2.1
jupyter_core     : 4.9.2
jupyter_server   : 1.16.0
jupyterlab       : 3.3.2
nbclient         : 0.5.13
nbconvert        : 6.4.5
nbformat         : 5.3.0
notebook         : 6.4.10
qtconsole        : not installed
traitlets        : 5.1.1
Known nbextensions:
  config dir: /home/bthayer/.cache/pypoetry/virtualenvs/opf-7uscUANZ-py3.10/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.3.2
/home/bthayer/.cache/pypoetry/virtualenvs/opf-7uscUANZ-py3.10/share/jupyter/labextensions
        jupyter-matplotlib v0.10.5 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.1.0 enabled OK (python, jupyterlab_widgets)
ianhi commented 2 years ago

The latter works for my system, while the former does not.

That's actually a bit surprising as they should point to same place. See here:

https://github.com/ipython/ipython/blob/7ad0dca1cbabbc564de3ea935ec03f72ce1d815e/IPython/core/pylabtools.py#L35-L36

As for what we should prefer between the two, I'm not sure there is a clear answer. It seems historically that widget was suggested, but to me ipympl makes a lot more sense as it allows discovery of the package via googling.

orome commented 2 years ago

... ipympl makes a lot more sense as it allows discovery of the package via googling.

It also avoids confusion with ipywidgets is in the following misleading fragment

%matplotlib widget
import ipywidgets as widgets