Stream Graph
Smartphone OS Market Share Stream
Stream graph showing mobile operating system market share evolution.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'layers': ['#3DDC84', '#007AFF', '#FF6600', '#00BCF2'],
'background': '#ffffff',
'text': '#1f2937',
'grid': '#e5e7eb',
}
np.random.seed(2626)
years = np.arange(2010, 2025)
n = len(years)
android = 20 + 3.5 * (years - 2010) + np.random.normal(0, 2, n)
android = np.clip(android, 0, 75)
ios = 15 + 1.2 * (years - 2010) + np.random.normal(0, 1.5, n)
ios = np.clip(ios, 0, 28)
windows = 5 + 3 * np.exp(-((years - 2014)**2) / 8) + np.random.normal(0, 1, n)
others = 60 - 3 * (years - 2010) + np.random.normal(0, 2, n)
others = np.clip(others, 2, 60)
data = [np.clip(d, 1, None) for d in [android, ios, windows, others]]
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=['Android', 'iOS', 'Windows Phone', 'Others'])
ax.axhline(0, color=COLORS['grid'], linewidth=0.5)
ax.set_xlim(2010, 2024)
ax.set_title('Smartphone OS Market Share', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Year', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Market Share (%)', color=COLORS['text'], fontsize=11)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), frameon=False, fontsize=9, ncol=4)
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
☕