Introduction to Visualization

Right click to download this notebook from GitHub.


In the previous step of the tutorial we made some plots using hvplot, which provides interactive plots using a syntax similar to the Pandas .plot() method. In addition to Pandas, hvPlot supports XArray, Dask, GeoPandas, and a variety of other libraries. The result of an hvplot call is a holoviews object. This might seem a little mysterious, so we'll take a minute to show how this works. In this tutorial step we'll use generated data for simplicity.

In [1]:
import numpy as np
import pandas as pd

index = pd.date_range('1/1/2000', periods=1000)

np.random.seed(11)  # seeding the state to make the output identical each time
data = np.random.randn(1000, 4)

df = pd.DataFrame(data, index=index, columns=list('ABCD')).cumsum()

df.head()
Out[1]:
A B C D
2000-01-01 1.749455 -0.286073 -0.484565 -2.653319
2000-01-02 1.741170 -0.605704 -1.021194 -2.337916
2000-01-03 2.162221 -1.671307 -1.907434 -2.813649
2000-01-04 2.851903 -1.110115 -3.212983 -3.933125
2000-01-05 3.588741 0.464519 -3.244058 -4.616571

Use hvplot to product an interactively explorable plot with panning, zooming, hovering, and clickable/selectable legends:

In [2]:
import hvplot.pandas

df.hvplot()