Stream Graph
Programming Language Trends Stream
Stream graph showing the rise and fall of programming language popularity over the decades.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'layers': ['#3776AB', '#F7DF1E', '#00599C', '#E34F26', '#4FC08D', '#FF6F00'],
'background': '#ffffff',
'text': '#1f2937',
'grid': '#e5e7eb',
}
np.random.seed(101)
years = np.arange(2010, 2025)
n = len(years)
# Language popularity
python = 10 + 4 * (years - 2010) + np.random.normal(0, 2, n)
javascript = 40 + 2 * (years - 2010) + 5 * np.sin((years - 2012) * np.pi / 5) + np.random.normal(0, 2, n)
cpp = 25 - 0.5 * (years - 2010) + np.random.normal(0, 2, n)
rust = 2 + 3 * (years - 2015) * (years > 2015) + np.random.normal(0, 1, n)
go = 5 + 2 * (years - 2012) * (years > 2012) + np.random.normal(0, 1, n)
typescript = 3 + 4 * (years - 2016) * (years > 2016) + np.random.normal(0, 1, n)
data = [np.clip(d, 1, None) for d in [python, javascript, cpp, rust, go, typescript]]
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=['Python', 'JavaScript', 'C++', 'Rust', 'Go', 'TypeScript'])
ax.axhline(0, color=COLORS['grid'], linewidth=0.5)
ax.set_xlim(2010, 2024)
ax.set_title('Programming Language Popularity (2010-2024)', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Year', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Popularity Index', 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
☕