0

%matplotlib widget

 2 years ago
source link: https://snakeycode.wordpress.com/2021/08/05/matplotlib-widget-not-working-in-jupyter-lab/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

%matplotlib widget not Working in Jupyter Lab

One of the best features of Jupyter Lab is the command that makes plots interactive: %matplotlib widget

I recently (Aug 2021) setup a Digital Ocean droplet to be a Jupyter Lab notebook server. I am aware that there are other ways of doing this: mybinder.org, Google colab, etc… But I could not get them working and could not look “under the hood” to figure out what was wrong.

I followed the instructions here. Things went pretty smoothly… except my plots stopped showing. Instead I got some text like:

Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), 

After googling, I found that this was a problem in 2019. None of those solutions worked. Then I found a solution for Jupyter Lab 3.x. Certainly my new install would have a semi-up-to-date version… Not so. The Jupyter Lab version was 1.2.6.

After:

conda update jupyterlab

%matplotlib widget started working.

I did some other fiddling before that to install a recent version of nodejs. I am not sure if that also helped make this work. But I know that updating jupyterlab is part or all of the solution.

Advertisements
Report this ad

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK