Skip to content

Instantly share code, notes, and snippets.

@dalgu90
Last active July 4, 2018 04:56
Show Gist options
  • Save dalgu90/c8a826a054565d261a787bc7bdf45e0f to your computer and use it in GitHub Desktop.
Save dalgu90/c8a826a054565d261a787bc7bdf45e0f to your computer and use it in GitHub Desktop.
Preparing for jupyter interactive
# First, you need to install node.js. After you install node.js, type `npm -v` for check
mkdir ~/.local
mkdir ~/node-latest-install
cd ~/node-latest-install
# curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 # For node.js v10.x, there is a hanging issue when installing jupyter-labextension
curl http://nodejs.org/dist/v8.9.0/node-v8.9.0.tar.gz | tar xz --strip-components=1
./configure --prefix=~/.local
make install -j20 # ok, fine, this step probably takes more than 30 seconds...
# curl -k -L https://npmjs.org/install.sh | sh # This doen't need now, since npm is installed together when installing node.js
# Then update jupyter lab
pip install ipympl
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib
# In the jupyter notebook,
import matplotlib.pyplot as plt
from ipywidgets import interact, widgets
%matplotlib inline
def f(n):
plt.plot([0,1,2],[0,1,n])
plt.show()
interact(f, n=widgets.IntSlider(min=1,max=21,step=2,value=1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment