Stream Graph

Video Game Sales by Region Stream

Stream visualization of video game sales distribution across global regions.

Output
Video Game Sales by Region Stream
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'layers': ['#EF4444', '#3B82F6', '#10B981', '#F59E0B', '#8B5CF6'],
    'background': '#ffffff',
    'text': '#1f2937',
    'grid': '#e5e7eb',
}

np.random.seed(2222)
years = np.arange(2010, 2025)
n = len(years)

north_america = 35 + 0.5 * (years - 2010) + 3 * np.sin((years - 2012) * np.pi / 4) + np.random.normal(0, 2, n)
europe = 28 + 0.4 * (years - 2010) + np.random.normal(0, 2, n)
asia = 25 + 1.2 * (years - 2010) + np.random.normal(0, 2, n)
latam = 8 + 0.3 * (years - 2010) + np.random.normal(0, 1, n)
other = 4 + 0.1 * (years - 2010) + np.random.normal(0, 0.5, n)

data = [np.clip(d, 1, None) for d in [north_america, europe, asia, latam, other]]

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=['North America', 'Europe', 'Asia Pacific', 'Latin America', 'Other'])

ax.axhline(0, color=COLORS['grid'], linewidth=0.5)
ax.set_xlim(2010, 2024)

ax.set_title('Video Game Sales by Region', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Year', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Sales ($ Billions)', 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

Did this help you?

Support PyLucid to keep it free & growing

Support