Ridgeline Plot

Music Streaming Peaks by Platform

Platform activity with vibrant neon gradients and transparency

Output
Music Streaming Peaks by Platform
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

np.random.seed(123)

platforms = ['Spotify', 'Apple Music', 'YouTube Music', 'Tidal', 'Deezer', 'SoundCloud']
colors = ['#1DB954', '#FC3C44', '#FF0000', '#00BFFF', '#FEAA2D', '#FF5500']

data = {
    'Spotify': np.random.beta(8, 3, 600) * 100,
    'Apple Music': np.random.beta(6, 4, 600) * 80,
    'YouTube Music': np.random.beta(7, 3, 600) * 90,
    'Tidal': np.random.beta(4, 5, 600) * 60,
    'Deezer': np.random.beta(5, 5, 600) * 70,
    'SoundCloud': np.random.beta(5, 4, 600) * 75
}

fig, ax = plt.subplots(figsize=(12, 8), facecolor='#ffffff')
ax.set_facecolor('#ffffff')

overlap = 1.6
x_range = np.linspace(0, 100, 300)

for i, (platform, streams) in enumerate(data.items()):
    kde = stats.gaussian_kde(streams, bw_method=0.3)
    y = kde(x_range) * 3.5
    baseline = i * overlap
    
    ax.fill_between(x_range, baseline, y + baseline, alpha=0.7, color=colors[i])
    ax.plot(x_range, y + baseline, color=colors[i], linewidth=2.5)
    
    ax.text(-3, baseline + 0.12, platform, fontsize=10, color='#1f2937',
            ha='right', va='bottom', fontweight='600')

ax.set_xlim(-35, 100)
ax.set_ylim(-0.3, len(platforms) * overlap + 1.8)
ax.set_xlabel('Streams (millions)', fontsize=12, color='#374151', fontweight='500')
ax.set_title('Music Streaming Peaks by Platform', fontsize=16, color='#1f2937', fontweight='bold', pad=20)

ax.tick_params(axis='x', colors='#374151', labelsize=10)
ax.tick_params(axis='y', left=False, labelleft=False)
ax.spines['bottom'].set_color('#e5e7eb')
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support