"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This exercise is entirely freeform. Get into groups of 3-4 people (if available!) and start building a dashboard, with everything you have learned in this tutorial. By the end of the exercise you should have a dashboard that:\n",
"\n",
"* Uses datashading to render the whole dataset\n",
"* Builds a pipeline using ``pn.rx``\n",
"* Uses a widget to filter the data either using linked selections or using a widget (e.g. a RangeSlider)\n",
"* Uses a widget to control some aspect of the styling of the plot (e.g. to select a colormap, color, or size)\n",
"* Is servable by running ``panel serve Advanced_Dashboarding.ipynb`` in the exercise directory"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pathlib\n",
"import colorcet as cc # noqa\n",
"import holoviews as hv # noqa\n",
"import numpy as np # noqa\n",
"import pandas as pd\n",
"import panel as pn\n",
"import xarray as xr\n",
"\n",
"import hvplot.pandas # noqa: API import\n",
"import hvplot.xarray # noqa: API import\n",
"\n",
"pn.extension()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As a starting point we will load the data; everything else is up to you:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"df = pd.read_parquet(pathlib.Path('../../data/earthquakes-projected.parq'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds = xr.open_dataarray(pathlib.Path('../../data/raster/gpw_v4_population_density_rev11_2010_2pt5_min.nc'))\n",
"cleaned_ds = ds.where(ds.values != ds.nodatavals).sel(band=1)\n",
"cleaned_ds.name = 'population'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You don't really know what to build? Here are some ideas:\n",
" \n",
"* Build a dashboard with a pipeline that filters the data on one or more of the columns (e.g. magnitude using a ``RangeSlider`` or time using a ``DateRangeSlider``) and then datashades it\n",
"* Build a dashboard with multiple views of the data (e.g. longitude vs. latitude, magnitude vs. depth etc.) and cross-filters the data (see the [Glaciers example](https://examples.holoviz.org/gallery/glaciers/glaciers.html) for reference)\n",
"* Build a dashboard that allows you to select multiple earthquakes and compute (and display) statistics on them."
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}