diff --git a/materials/fds-audiences.pdf b/materials/fds-audiences.pdf new file mode 100644 index 0000000..dc64645 Binary files /dev/null and b/materials/fds-audiences.pdf differ diff --git a/notebooks/flu_data_scaffold.ipynb b/notebooks/flu_data_scaffold.ipynb new file mode 100644 index 0000000..814746f --- /dev/null +++ b/notebooks/flu_data_scaffold.ipynb @@ -0,0 +1,177 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Advanced Altair: Multiple Coordinated Views" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "import altair as alt\n", + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
weekcontinentcountryvalue
01AsiaAfghanistan5.0
12AsiaAfghanistan13.0
23AsiaAfghanistan4.0
34AsiaAfghanistan0.0
45AsiaAfghanistan0.0
\n", + "
" + ], + "text/plain": [ + " week continent country value\n", + "0 1 Asia Afghanistan 5.0\n", + "1 2 Asia Afghanistan 13.0\n", + "2 3 Asia Afghanistan 4.0\n", + "3 4 Asia Afghanistan 0.0\n", + "4 5 Asia Afghanistan 0.0" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "flu = pd.read_csv('flunet2010_11countries.csv', header=[0,1])\n", + "cols = flu.columns.tolist()\n", + "normed = pd.melt(flu, id_vars=[cols[0]], value_vars=cols[1:], var_name=['continent','country'])\n", + "normed = normed.rename(columns={normed.columns[0]: 'week'})\n", + "normed.head()\n", + "\n", + "# setup renderer for Jupyter Notebooks (not needed for Juptyer Lab)\n", + "alt.renderers.enable('notebook')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization 1\n", + "\n", + "#### Create Linked Plots Showing Flu Cases per Country and Total Flu Cases per Week" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Selections:\n", + "* Click to select individual countries.\n", + "* Hold shift and click to select multiple countries.\n", + "* Brush barchart to narrow top view." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization 2\n", + "\n", + "#### Create an Overview+Detail Plot Showing Flu Cases per Country" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualization 3\n", + "#### Create Linked Plots Showing Flu Cases per Country per Week and Total Flu Cases per Country\n", + "For this visualization we create two linked plots. One that shows flu cases per country per week and a second on that show the total of all flu cases per country." + ] + } + ], + "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.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}