In [1]:
import time
In [2]:
from numpy import cumprod, linspace, random
In [3]:
from bokeh.sampledata.stocks import AAPL, FB, GOOG, IBM, MSFT
from bokeh.plotting import figure, output_notebook, show
In [4]:
num_points = 300

now = time.time()
dt = 24*3600 # days in seconds
dates = linspace(now, now + num_points*dt, num_points) * 1000 # times in ms
acme = cumprod(random.lognormal(0.0, 0.04, size=num_points))
choam = cumprod(random.lognormal(0.0, 0.04, size=num_points))
In [5]:
output_notebook()
Loading BokehJS ...
In [6]:
p1 = figure(x_axis_type = "datetime")

p1.line(dates, acme, color='#1F78B4', legend='ACME')
p1.line(dates, choam, color='#FB9A99', legend='CHOAM')

p1.title.text = "Stock Returns"
p1.grid.grid_line_alpha=0.3

show(p1)
Out[6]:

<Bokeh Notebook handle for In[6]>

In [7]:
p2 = figure()

p2.scatter(acme, choam, color='#A6CEE3', legend='close')

p2.title.text = "ACME / CHOAM Correlations"
p2.grid.grid_line_alpha=0.3

show(p2)
Out[7]:

<Bokeh Notebook handle for In[7]>

In [ ]: