Horizon Chart
Social Media Engagement Horizon
Social media engagement metrics horizon chart with coral pink gradient showing interaction patterns.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
COLORS = {
'bands': ['#FFE4E6', '#FDA4AF', '#F43F5E', '#E11D48'],
'background': '#ffffff',
'text': '#1f2937',
'grid': '#e5e7eb',
}
np.random.seed(1111)
hours = np.arange(0, 168) # Week
# Engagement: peaks during lunch and evening
daily = 40 * np.exp(-((hours % 24 - 12)**2) / 8) + 30 * np.exp(-((hours % 24 - 20)**2) / 6)
engagement = daily + np.random.exponential(15, len(hours))
engagement = np.clip(engagement, 0, 100)
engagement_norm = engagement / 100
fig, ax = plt.subplots(figsize=(14, 3), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])
band = 0.25
ax.fill_between(hours, 0, np.clip(engagement_norm, 0, band), color=COLORS['bands'][0])
ax.fill_between(hours, 0, np.clip(engagement_norm - band, 0, band), color=COLORS['bands'][1])
ax.fill_between(hours, 0, np.clip(engagement_norm - 2*band, 0, band), color=COLORS['bands'][2])
ax.fill_between(hours, 0, np.clip(engagement_norm - 3*band, 0, band), color=COLORS['bands'][3])
ax.set_xlim(0, 167)
ax.set_ylim(0, 0.3)
ax.set_title('Social Media Engagement Rate (%)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Day', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Engagement (%)', color=COLORS['text'], fontsize=10)
ax.set_xticks([0, 24, 48, 72, 96, 120, 144])
ax.set_xticklabels(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'])
for spine in ax.spines.values():
spine.set_color(COLORS['grid'])
ax.tick_params(colors=COLORS['text'], labelsize=9)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Time Series
More Horizon Chart examples
☕