{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "URL: http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html\n",
    "\n",
    "Most examples work across multiple plotting backends, this example is also available for:\n",
    "\n",
    "* [Matplotlib - US unemployment example](../matplotlib/us_unemployment.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import holoviews as hv\n",
    "hv.extension('bokeh')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Defining data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from bokeh.sampledata.unemployment1948 import data\n",
    "\n",
    "colors = [\"#75968f\", \"#a5bab7\", \"#c9d9d3\", \"#e2e2e2\", \"#dfccce\", \"#ddb7b1\", \"#cc7878\", \"#933b41\", \"#550b1d\"]\n",
    "\n",
    "data = pd.melt(data.drop('Annual', 1), id_vars='Year', var_name='Month', value_name='Unemployment')\n",
    "\n",
    "heatmap = hv.HeatMap(data, label=\"US Unemployment (1948 - 2013)\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib.colors import ListedColormap\n",
    "heatmap.options(width=900, height=400, xrotation=45, xaxis='top', labelled=[], \n",
    "                tools=['hover'], cmap=ListedColormap(colors))"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
