Heatmap
API Performance Heatmap
Endpoint response times by hour and day
Output
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
np.random.seed(42)
# Hours and days
hours = [f'{h:02d}:00' for h in range(24)]
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
# Response times (ms)
times = np.random.randint(50, 150, (24, 7))
# Add patterns
times[9:18, :5] += 50 # Business hours higher
times[12:14, :5] += 30 # Lunch peak
times[0:6, :] -= 30 # Night low
times = np.clip(times, 20, 250)
df = pd.DataFrame(times, index=hours, columns=days)
# NEON performance colormap (green=fast, red=slow)
neon_perf = LinearSegmentedColormap.from_list('neon_perf', ['#6CF527', '#F5B027', '#F5276C'])
fig, ax = plt.subplots(figsize=(8, 9), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
sns.heatmap(df, cmap=neon_perf, linewidths=1, linecolor='#ffffff',
cbar_kws={'shrink': 0.5, 'label': 'Response Time (ms)'}, ax=ax)
ax.set_title('API Response Time Heatmap', color='#1f2937', fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Day of Week', color='#1f2937', fontsize=11)
ax.set_ylabel('Hour', color='#1f2937', fontsize=11)
ax.tick_params(colors='#374151', labelsize=9)
# Add SLA threshold annotation
ax.text(0.98, 0.02, 'SLA: <200ms', transform=ax.transAxes, ha='right', va='bottom',
fontsize=10, color='#F5276C', fontweight='bold',
bbox=dict(boxstyle='round', facecolor='#ffffff', edgecolor='#F5276C'))
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Heatmaps & Density
More Heatmap examples
☕