Skip to content

Instantly share code, notes, and snippets.

@charlesfrye
Created February 12, 2020 22:13
Show Gist options
  • Save charlesfrye/47453ea3df7391f93c8bd8da318d5184 to your computer and use it in GitHub Desktop.
Save charlesfrye/47453ea3df7391f93c8bd8da318d5184 to your computer and use it in GitHub Desktop.
Testing interactive widgets for plotting in JupyterLab - copy contents into notebook files and run.
import ipywidgets
ipywidgets.IntSlider()
import ipywidgets
from ipywidgets import interact
import matplotlib.pyplot as plt
### CELL NECESSARY BREAK HERE
%matplotlib widget
f, ax = plt.subplots()
@interact
def f(m=1):
ax.plot([0, m])
@charlesfrye
Copy link
Author

Testing Interactive Figures in JupyterLab

These two files contain code for checking whether the libraries and extensions needed to make interactive plots in JupyterLab are installed properly.

Once placed into notebooks and executed, intended results are screenshotted below.

For test_interact:

Screen Shot 2020-02-12 at 2 02 22 PM

IF YOU JUST SEE A TEXT OUTPUT INSTEAD OF A SLIDER, WIDGETS ARE NOT INSTALLED PROPERLY

For test_interact_fig:

Screen Shot 2020-02-12 at 2 11 24 PM

IF YOU SEE A NON-INTERACTIVE PLOT, IPYMPL AND INTERACTIVE PLOTS ARE NOT INSTALLED PROPERLY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment