Stream Graph
Content Consumption by Format Stream
Stream graph showing digital content consumption trends by format type.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'layers': ['#EF4444', '#F59E0B', '#10B981', '#3B82F6', '#8B5CF6'],
'background': '#ffffff',
'text': '#1f2937',
'grid': '#e5e7eb',
}
np.random.seed(3030)
years = np.arange(2015, 2025)
n = len(years)
video = 30 + 4 * (years - 2015) + np.random.normal(0, 2, n)
audio = 20 + 2 * (years - 2015) + np.random.normal(0, 1, n)
text = 35 - 1 * (years - 2015) + np.random.normal(0, 2, n)
interactive = 10 + 1.5 * (years - 2015) + np.random.normal(0, 1, n)
live = 5 + 2 * (years - 2018) * (years >= 2018) + np.random.normal(0, 0.5, n)
data = [np.clip(d, 1, None) for d in [video, audio, text, interactive, live]]
fig, ax = plt.subplots(figsize=(14, 6), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])
ax.stackplot(years, *data, colors=COLORS['layers'], alpha=0.85, baseline='sym',
labels=['Video', 'Audio/Podcasts', 'Text/Articles', 'Interactive', 'Live Streaming'])
ax.axhline(0, color=COLORS['grid'], linewidth=0.5)
ax.set_xlim(2015, 2024)
ax.set_title('Digital Content Consumption by Format', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Year', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Hours/Week per User', color=COLORS['text'], fontsize=11)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), frameon=False, fontsize=9, ncol=5)
for spine in ax.spines.values():
spine.set_color(COLORS['grid'])
ax.tick_params(colors=COLORS['text'], labelsize=9)
plt.tight_layout()
plt.subplots_adjust(bottom=0.18)
plt.show()
Library
Matplotlib
Category
Time Series
More Stream Graph examples
☕