In [ ]:
from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
from IPython.display import display
import pylab
In [ ]:
##http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html
In [ ]:
foo = widgets.IntSlider(value=7,
min=0,
max=10,
step=1,
description='Test:',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True,
readout_format='i',
slider_color='white')
In [ ]:
foo
In [ ]:
def f(x):
return x
interact(f, x=widgets.IntSlider(min=-10,max=30,step=1,value=10))
In [ ]:
w = widgets.IntSlider()
display(w)
In [ ]:
display(w)
In [ ]:
w.close()
In [ ]:
w.value
In [ ]:
a = widgets.FloatText()
b = widgets.FloatSlider()
display(a,b)
mylink = widgets.jslink((a, 'value'), (b, 'value'))
In [ ]:
mylink.close()
In [ ]:
a.value
In [ ]:
import math
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas
import warnings
In [ ]:
t = np.arange(0., 5., 0.2)
# red dashes, blue squares and green triangles
plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
plt.show()
In [ ]:
#no love for the simple interact plot...
interact(lambda t,m: plt.plot(t,t*m), m=(0.0,10.0,0.01))
display()
In [ ]:
t = np.arange(0., 5., 0.2)
w = widgets.FloatSlider()
display(w)
In [ ]:
# red dashes, blue squares and green triangles
plt.plot(t, t*w.value)
plt.show()
In [ ]:
In [ ]:
w = widgets.FloatSlider()
display(w)
In [ ]:
w.value
In [ ]:
t = np.arange(0.0,10.0,0.01) * 2 * np.pi
In [ ]:
def plt_func(f=pfunc, m=1):
return(plt.plot(t,np.sin(t)*m))
In [ ]:
In [ ]:
plt_func(m=3)
In [ ]:
interact(plt_func, m=(0.0,10.0,0.01))
In [ ]:
def viewfunc(amp, scale):
t = np.arange(0.0,10.0,0.01) * 2 * np.pi
plt.plot(t,np.sin(t * scale)*amp)
In [ ]:
amp_slide = widgets.FloatSlider(min=0, max=1.0, value=0.5, step=0.01)
scale_slide = widgets.FloatSlider(min=0, max=1.0, value=0.5, step=0.01)
interact(viewfunc, amp=amp_slide,scale=scale_slide)
In [ ]: