Area Chart
Music Streaming Activity
Weekly listening hours by genre over time
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(42)
weeks = np.arange(1, 53)
# Genre listening patterns
pop = 8 + 3*np.sin(weeks/8) + np.random.normal(0, 1, len(weeks))
hiphop = 6 + 2*np.sin(weeks/10 + 1) + np.random.normal(0, 0.8, len(weeks))
electronic = 4 + 2*np.sin(weeks/6 + 2) + np.random.normal(0, 0.6, len(weeks))
rock = 3 + 1.5*np.sin(weeks/12) + np.random.normal(0, 0.5, len(weeks))
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
ax.stackplot(weeks, pop, hiphop, electronic, rock,
colors=['#F5276C', '#27D3F5', '#6CF527', '#F5B027'],
labels=['Pop', 'Hip-Hop', 'Electronic', 'Rock'], alpha=0.85)
ax.set_xlabel('Week', color='white', fontsize=11)
ax.set_ylabel('Hours Listened', color='white', fontsize=11)
ax.set_title('Music Listening by Genre', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
spine.set_color('#333333')
ax.set_xlim(1, 52)
ax.legend(facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white', loc='upper right')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Basic Charts
More Area Chart examples
☕