{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from collections import OrderedDict\n",
    "\n",
    "import numpy as np\n",
    "\n",
    "from bokeh.charts import Area, output_notebook, gridplot, show\n",
    "from bokeh.palettes import (Blues9, BrBG9, BuGn9, BuPu9, GnBu9, Greens9, \n",
    "                            Greys9, OrRd9, Oranges9, PRGn9, PiYG9, PuBu9, \n",
    "                            PuBuGn9, PuOr9, PuRd9, Purples9, RdBu9, RdGy9, \n",
    "                            RdPu9, RdYlBu9, RdYlGn9, Reds9, Spectral9, YlGn9, \n",
    "                            YlGnBu9, YlOrBr9, YlOrRd9)\n",
    "\n",
    "output_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "standard_palettes = OrderedDict([(\"Blues9\", Blues9), (\"BrBG9\", BrBG9), \n",
    "                                (\"BuGn9\", BuGn9), (\"BuPu9\", BuPu9),\n",
    "                                (\"GnBu9\", GnBu9), (\"Greens9\", Greens9), \n",
    "                                (\"Greys9\", Greys9), (\"OrRd9\", OrRd9),\n",
    "                                (\"Oranges9\", Oranges9), (\"PRGn9\", PRGn9), \n",
    "                                (\"PiYG9\", PiYG9), (\"PuBu9\", PuBu9),\n",
    "                                (\"PuBuGn9\", PuBuGn9), (\"PuOr9\", PuOr9), \n",
    "                                (\"PuRd9\", PuRd9), (\"Purples9\", Purples9), \n",
    "                                (\"RdBu9\", RdBu9), (\"RdGy9\", RdGy9), \n",
    "                                (\"RdPu9\", RdPu9), (\"RdYlBu9\", RdYlBu9), \n",
    "                                (\"RdYlGn9\", RdYlGn9), (\"Reds9\", Reds9), \n",
    "                                (\"Spectral9\", Spectral9), (\"YlGn9\", YlGn9),\n",
    "                                (\"YlGnBu9\", YlGnBu9), (\"YlOrBr9\", YlOrBr9), \n",
    "                                (\"YlOrRd9\", YlOrRd9)])\n",
    "\n",
    "def create_area_chart(data, palette):\n",
    "    _chart_styling = dict(height=300,\n",
    "                          width=300,\n",
    "                          xgrid=False,\n",
    "                          ygrid=False,\n",
    "                          tools=None)\n",
    "    return Area(data,\n",
    "                title=palette,\n",
    "                stacked=True,\n",
    "                palette=standard_palettes.get(palette),\n",
    "                **_chart_styling)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "data = np.random.random_integers(low=5, high=13, size=[9,20])\n",
    "\n",
    "area_charts = [create_area_chart(data, palette) for palette in standard_palettes.keys()]\n",
    "area_charts = np.reshape(area_charts, newshape=[9,3]).tolist()\n",
    "\n",
    "show(gridplot(area_charts))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
