I'm getting into using Jupyterlab from Jupyter notebooks. In notebooks I used to use:
import matplotlib.pyplot as plt
%matplotlib notebook
plt.figure()
x = [1,2,3]
y = [4,5,6]
plt.plot(x,y)
for interactive plots. Which now gives me (in jupyterlab):
JavaScript output is disabled in JupyterLab
I have also tried the magic (with jupyter-matplotlib installed):
%matplotlib ipympl
But that just returns:
FigureCanvasNbAgg()
Inline plots:
%matplotlib inline
work just fine, but I want interactive plots.
nodejs
, e.g. conda install nodejs
.ipympl
, e.g. pip install ipympl
.pip install --upgrade jupyterlab
.]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
.
%matplotlib widget
.Not recommended, but to blindly get the widget extension working in Anaconda, you can run the following in a terminal window:
conda install -y nodejs
pip install ipympl
pip install --upgrade jupyterlab
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyter-matplotlib
jupyter nbextension enable --py widgetsnbextension