In [ ]:
import bokeh
bokeh.load_notebook()
In [ ]:
from collections import OrderedDict
import numpy as np
from bokeh.charts import Histogram
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)
hist = Histogram(normal_dist, bins=50, mu=mu, sigma=sigma,
title="kwargs, dict_input", ylabel="frequency", legend="top_left",
width=400, height=350, notebook=True)
hist.show()
In [ ]:
import pandas as pd
df = pd.DataFrame(normal_dist)
hist = Histogram(df, bins=50, mu=mu, sigma=sigma,
title="no_tools, df_input", ylabel="frequency", legend="top_left",
tools=True, width=400, height=350, notebook=True)
hist.show()
In [ ]:
from bokeh.plotting import output_notebook, show
output_notebook()
# Testing with 1D array of scalars
hist = Histogram(normal, bins=50, mu=mu, sigma=sigma,
title="kwargs, dict_input", ylabel="frequency", legend="top_left",
width=500, height=350, notebook=True)
show(hist)
In [ ]:
distributions = OrderedDict(normal=normal, lognormal=lognormal)
hist2 = Histogram(distributions, bins=50, title="kwargs, dict_input", ylabel="frequency", legend="top_left",
width=500, height=350, notebook=True)
show(hist2)
In [ ]:
df = pd.DataFrame(distributions)
hist = Histogram(df, bins=50,title="kwargs, dict_input", ylabel="frequency", legend="top_left",
width=500, height=350, notebook=True)
show(hist)
In [ ]: