{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n", "\n", "from collections import OrderedDict\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, Inferno9, Magma9, \n", " Plasma9, Viridis9)\n", "\n", "output_notebook()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "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), (\"Inferno9\", Inferno9),\n", " (\"Magma9\", Magma9), (\"Plasma9\", Plasma9),\n", " (\"Viridis9\", Viridis9)])\n", "\n", "def create_area_chart(data, palette):\n", " _chart_styling = dict(xgrid=False,\n", " ygrid=False,\n", " tools=None)\n", " return Area(data,\n", " title=palette,\n", " stack=True,\n", " palette=standard_palettes.get(palette),\n", " **_chart_styling)" ] }, { "cell_type": "code", "execution_count": null, "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", "\n", "show(gridplot(area_charts, ncols=3, plot_width=300, plot_height=300))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [] }, { "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.4" } }, "nbformat": 4, "nbformat_minor": 0 }