In [ ]:
from collections import OrderedDict
import pandas as pd
from bokeh.charts import Horizon, output_notebook, show

# Here is some code to read in some stock data from the Yahoo Finance API
AAPL = pd.read_csv(
    "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010",
    parse_dates=['Date'])
MSFT = pd.read_csv(
    "http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2000&d=0&e=1&f=2010",
    parse_dates=['Date'])
IBM = pd.read_csv(
    "http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=1&c=2000&d=0&e=1&f=2010",
    parse_dates=['Date'])

xyvalues = OrderedDict(
    AAPL=AAPL['Adj Close'],
    Date=AAPL['Date'],
    MSFT=MSFT['Adj Close'],
    IBM=IBM['Adj Close'],
)
output_notebook()
h = Horizon(xyvalues, index='Date', title="horizon plot using stock inputs",
                width=800, height=300)
show(h)

In [ ]:
# example with blaze Data
from blaze import Data
from pandas import DataFrame
bd = Data(DataFrame(xyvalues))
h = Horizon(bd, index='Date', title="horizon plot using stock inputs",
                width=800, height=300, filename="horizon.html")

show(h)

In [ ]:
# example with random data
import numpy as np

x = np.linspace(0, np.pi*4, 137)
y = (2*np.random.normal(size=137) + x**2)
xx = np.hstack([-1*x[::-1], x])
yy = np.hstack([-1*y[::-1], y])
xyvalues = OrderedDict(x=xx, y=yy, y2=yy, y3=yy, y4=yy, y5=yy)
h = Horizon(xyvalues, index='x', title="test horizon", ylabel='Random')
show(h)

In [ ]: