{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"HoloViz\n", "

Exercise 6: Advanced Dashboarding

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This exercise is entirely freeform. Get into groups of 3-4 people 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 the ``.apply`` method \n", "* Uses a widget to filter the data either by cross-filtering with a linked stream (e.g. a BoundsXY stream) 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 colorcet as cc # noqa\n", "import holoviews as hv # noqa\n", "import numpy as np # noqa\n", "import dask.dataframe as dd\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": [ "df = dd.read_parquet('../../data/earthquakes.parq').repartition(npartitions=4).persist()\n", "\n", "ds = xr.open_dataarray('../../data/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 using ``BoundsXY`` streams (see the [Glaciers notebook](https://github.com/pyviz-demos/glaciers/blob/master/glaciers.ipynb) for reference)\n", "* Build a dashboard that allows you to select multiple earthquakes using a 'box_select' tool and a ``Selection1D`` stream and compute statistics on them." ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }