{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Most examples work across multiple plotting backends, this example is also available for:\n",
    "\n",
    "* [Bokeh - dropdown_economic](../bokeh/dropdown_economic.ipynb)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import holoviews as hv\n",
    "from holoviews import dim, opts\n",
    "\n",
    "hv.extension('matplotlib')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Declaring data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n",
    "key_dimensions   = [('year', 'Year'), ('country', 'Country')]\n",
    "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n",
    "                    ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n",
    "macro = hv.Table(macro_df, key_dimensions, value_dimensions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "gdp_curves = macro.to.curve('Year', 'GDP Growth')\n",
    "gdp_unem_scatter = macro.to.scatter('Year', ['GDP Growth', 'Unemployment'])\n",
    "annotations = hv.Arrow(1973, 8, 'Oil Crisis', 'v') * hv.Arrow(1975, 6, 'Stagflation', 'v') *\\\n",
    "hv.Arrow(1979, 8, 'Energy Crisis', 'v') * hv.Arrow(1981.9, 5, 'Early Eighties\\n Recession', 'v')\n",
    "\n",
    "(gdp_curves * gdp_unem_scatter * annotations).opts(\n",
    "    opts.Curve(color='k'),\n",
    "    opts.Scatter(color='Unemployment', s=dim('Unemployment')*10, cmap='Blues', edgecolors='k',\n",
    "                 aspect=2, fig_size=250, show_frame=False))"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
