Layering

Learn and practice the fundamentals of layering.

Layering is a data storytelling technique where we reveal our story gradually to help emphasize certain elements of it.

Let's take a look at a brief example of layering with the Walmart store openings dataset.

Consider the following line plot where we draw the number of Walmart stores across the United States from 1962–2006, using the entire dataset:

Press + to interact
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/1962_2006_walmart_store_openings.csv')
#Generate a bar plot using the number of instances of continents
plt.figure(figsize=(10, 7))
fig = df['YEAR'].value_counts().sort_index().plot.line().figure
#Label the axes and title
plt.xlabel("Years")
plt.xticks(rotation=50, horizontalalignment="center")
plt.title("Number of Walmart Stores over the years")
plt.ylabel("Number of Walmart Stores")
fig.savefig('output/to.png')
plt.close(fig)

Let's now explore how we can break this information down via layering.

Simple layering case study

...