{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from collections import OrderedDict\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from bokeh.charts import Histogram, output_notebook, show\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "mu, sigma = 0, 0.5\n",
    "normal = np.random.normal(mu, sigma, 1000)\n",
    "lognormal = np.random.lognormal(mu, sigma, 1000)\n",
    "\n",
    "distributions = OrderedDict(normal=normal, lognormal=lognormal)\n",
    "normal_dist = OrderedDict(normal=normal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hist = Histogram(\n",
    "    normal_dist, bins=50, mu=mu, sigma=sigma,\n",
    "    title=\"Histogram, dict input\", ylabel=\"frequency\", \n",
    "    legend=\"top_left\", width=400, height=350)\n",
    "show(hist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "df = pd.DataFrame(normal_dist)\n",
    "hist = Histogram(\n",
    "    df, bins=50, mu=mu, sigma=sigma,\n",
    "    title=\"Histogram, pandas input\", ylabel=\"frequency\", \n",
    "    tools=True, width=400, height=350, legend=\"top_left\")\n",
    "show(hist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "hist = Histogram(\n",
    "    normal, bins=50, mu=mu, sigma=sigma,\n",
    "    title=\"Histogram, array input\", ylabel=\"frequency\",\n",
    "    width=500, height=350, legend=\"top_left\")\n",
    "show(hist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from blaze import Data\n",
    "\n",
    "b = Data(df)\n",
    "hist = Histogram(b, bins=50,title=\"kwargs, dict_input\", ylabel=\"frequency\", legend=\"top_right\",\n",
    "                 width=500, height=350, notebook=True)\n",
    "show(hist)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
