So far we have generated plots using hvPlot, but we haven’t discussed what exactly these plots are and how they differ from the output of other libraries offering the
.plot API. Here we will see that the
.hvplot() output is actually a rich, composable and compositional object that can be used in many different ways, not just as an immediate plot. Specifically, hvPlot generates HoloViews objects rendered using the Bokeh backend (by default) so that they support interactive hovering, panning, and zooming.
In this notebook, we’ll examine the output of hvPlot calls to take a look at individual HoloViews objects. Then we will see how these “elements” offer us powerful ways of combining and composing layered visualizations.
Read in the data#
We’ll read in the data as before, and also reindex by time so that we can more easily do resampling.
import pathlib import pandas as pd import numpy as np
%%time df = pd.read_parquet(pathlib.Path('../data/earthquakes-projected.parq')) df = df.set_index(df.time)
CPU times: user 4.1 s, sys: 1.22 s, total: 5.31 s Wall time: 5.32 s
In this section we’ll start looking at how we can group plots to gain a deeper understanding of the data. We’ll start by resampling the data to explore patterns in number and magnitude of earthquakes over time.
import hvplot.pandas # noqa: adds hvplot method to pandas objects