Plotting

Exercise 3

In this exercise we will explore hvplot some more which we will build on in Exercise 4 to create a custom linked visualization.

Loading the data as before

We will be building a new visualization based on the same data we have cleaned and filtered in the rest of the tutorial. First we load the DataFrame of the >=7 earthquakes:

In [1]:
import xarray as xr
import dask.dataframe as dd
import holoviews as hv
from holoviews import streams # noqa
import hvplot.dask   # noqa
import hvplot.pandas # noqa
import hvplot.xarray # noqa: adds hvplot method to xarray objects

df = dd.read_parquet('../../data/earthquakes.parq')
cleaned_df = df.copy()
cleaned_df['mag'] = df.mag.where(df.mag > 0)
cleaned_reindexed_df = cleaned_df.set_index(cleaned_df.time)
cleaned_reindexed_df = cleaned_reindexed_df.persist()
most_severe = cleaned_reindexed_df[cleaned_reindexed_df.mag >= 7].compute()