In [ ]:
from collections import OrderedDict
import numpy as np
import pandas as pd
from bokeh.charts import Histogram, output_notebook, show
output_notebook()
In [ ]:
mu, sigma = 0, 0.5
normal = np.random.normal(mu, sigma, 1000)
lognormal = np.random.lognormal(mu, sigma, 1000)
distributions = OrderedDict(normal=normal, lognormal=lognormal)
normal_dist = OrderedDict(normal=normal)
In [ ]:
hist = Histogram(
normal_dist, bins=50, mu=mu, sigma=sigma,
title="Histogram, dict input", ylabel="frequency",
legend="top_left", width=400, height=350)
show(hist)
In [ ]:
df = pd.DataFrame(normal_dist)
hist = Histogram(
df, bins=50, mu=mu, sigma=sigma,
title="Histogram, pandas input", ylabel="frequency",
tools=True, width=400, height=350, legend="top_left")
show(hist)
In [ ]:
hist = Histogram(
normal, bins=50, mu=mu, sigma=sigma,
title="Histogram, array input", ylabel="frequency",
width=500, height=350, legend="top_left")
show(hist)
In [ ]:
from blaze import Data
b = Data(df)
hist = Histogram(b, bins=50,title="kwargs, dict_input", ylabel="frequency", legend="top_right",
width=500, height=350, notebook=True)
show(hist)
In [ ]: