jupyterlab interactive plot
As per Georgy's suggestion, this was caused by Node.js not being installed.
To enable the jupyter-matplotlib backend, use the matplotlib Jupyter magic:
%matplotlib widget
import matplotlib.pyplot as plt
plt.figure()
x = [1,2,3]
y = [4,5,6]
plt.plot(x,y)
More info here jupyter-matplotlib on GitHub
JupyterLab 3.0+
Install
jupyterlab
andipympl
.For
pip
users:pip install --upgrade jupyterlab ipympl
For
conda
users:conda update -c conda-forge jupyterlab ipympl
Restart JupyterLab.
Decorate the cell containing plotting code with the header:
%matplotlib widget # plotting code goes here
JupyterLab 2.0
Install
nodejs
, e.g.conda install -c conda-forge nodejs
.Install
ipympl
, e.g.conda install -c conda-forge ipympl
.[Optional, but recommended.] Update JupyterLab, e.g.
conda update -c conda-forge jupyterlab==2.2.9==py_0
.[Optional, but recommended.] For a local user installation, run:
export JUPYTERLAB_DIR="$HOME/.local/share/jupyter/lab"
.Install extensions:
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter labextension install jupyter-matplotlib
Enable widgets:
jupyter nbextension enable --py widgetsnbextension
.Restart JupyterLab.
Decorate with
%matplotlib widget
.