matplotlib / ipympl

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

How to make this work in Jupyterlab Code Console? #429

Closed varung closed 2 years ago

varung commented 2 years ago

Describe the issue

Interactive plots do not show up in the code console

from matplotlib import pyplot as plt
%matplotlib widget
plt.figure(figsize=(10,10))
plt.plot(range(10))
plt.show()

In code console, I just see the string "loading widget"

Versions

Please include the result of the following command, which will print out the version of python, ipympl and the Jupyter ecosystem.

python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list

-->

 3.7.5 (default, Oct 25 2019, 15:51:11) 
[GCC 7.3.0]
ipympl version: 0.8.7
Selected Jupyter core packages...
IPython          : 7.31.1
ipykernel        : 5.5.5
ipywidgets       : 7.6.5
jupyter_client   : 7.1.2
jupyter_core     : 4.9.1
jupyter_server   : 1.13.5
jupyterlab       : 3.2.9
nbclient         : 0.5.10
nbconvert        : 6.4.2
nbformat         : 5.1.3
notebook         : 6.4.8
qtconsole        : 4.6.0
traitlets        : 5.1.1
Known nbextensions:
  config dir: /home/varung/miniconda3/envs/tess/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      pydeck/extension  enabled 
      - Validating: problems found:
        - require?  X pydeck/extension
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
  config dir: /etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.2.9
/home/varung/miniconda3/envs/tess/share/jupyter/labextensions
        jupyter-matplotlib v0.10.5 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)
martinRenou commented 2 years ago

We need https://github.com/jupyter-widgets/ipywidgets/pull/3004 before it can work in ipympl