ipywidgets


In [ ]:
from ipywidgets import Button, IntSlider, HBox

In [ ]:
button = Button(description='Click me!', button_style='success')

In [ ]:
button

In [ ]:
button

In [ ]:
slider = IntSlider()

In [ ]:
slider

In [ ]:
slider

In [ ]:
slider.value

In [ ]:
slider.value = 70

bqplot


In [ ]:
import numpy as np
from bqplot import *

In [ ]:
security_1 = np.cumsum(np.random.randn(150)) + 100.
security_2 = np.cumsum(np.random.randn(150)) + 100.

sc_x = LinearScale()
sc_y = LinearScale()

line = Lines(x=np.arange(len(security_1)), y=security_1,
             scales={'x': sc_x, 'y': sc_y})
ax_x = Axis(scale=sc_x, label='Index')
ax_y = Axis(scale=sc_y, orientation='vertical', label='y-values of Security 1')

Figure(marks=[line], axes=[ax_x, ax_y], title='Security 1', animation_duration=1000)

In [ ]:
line.colors = ['DarkOrange']

In [ ]:
line.y = np.cumsum(np.random.randn(150)) + 100.

In [ ]:
button = Button(description='Click me!', button_style='success')
slider = IntSlider()

def on_click(event):
    line.y = np.cumsum(np.random.randn(150)) + slider.value

button.on_click(on_click)
HBox((button, slider))

In [ ]:
x_data = np.random.randn(1000)

x_sc = LinearScale()
y_sc = LinearScale()

hist = Bins(sample=x_data, scales={'x': x_sc, 'y': y_sc}, padding=0,)
ax_x = Axis(scale=x_sc, tick_format='0.2f')
ax_y = Axis(scale=y_sc, orientation='vertical')

Figure(marks=[hist], axes=[ax_x, ax_y], padding_y=0)