Heatmap
Server Response Time Grid
Modern heatmap of API response times across endpoints
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
np.random.seed(789)
endpoints = ['/api/users', '/api/auth', '/api/products', '/api/orders', '/api/payments', '/api/search', '/api/analytics']
hours = ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00']
data = np.random.randint(20, 150, (len(endpoints), len(hours)))
data[5, 2:5] = [180, 220, 195]
data[6, 3:5] = [250, 280]
colors = ['#f0fdf4', '#bbf7d0', '#4ade80', '#16a34a']
cmap = LinearSegmentedColormap.from_list('GreenGrad', colors, N=256)
fig, ax = plt.subplots(figsize=(12, 8), facecolor='white')
im = ax.imshow(data, cmap=cmap, aspect='auto', vmin=0, vmax=300)
ax.set_xticks(range(len(hours)))
ax.set_yticks(range(len(endpoints)))
ax.set_xticklabels(hours, fontsize=10, color='#374151')
ax.set_yticklabels(endpoints, fontsize=10, color='#1f2937', family='monospace')
for i in range(len(endpoints)):
for j in range(len(hours)):
val = data[i, j]
color = '#1f2937'
ax.text(j, i, f'{val}ms', ha='center', va='center', fontsize=9, fontweight='500', color=color)
cbar = plt.colorbar(im, ax=ax, shrink=0.6, pad=0.02)
cbar.set_label('Response Time (ms)', fontsize=11, color='#1f2937')
cbar.ax.tick_params(labelsize=9, colors='#6b7280')
cbar.outline.set_visible(False)
for spine in ax.spines.values():
spine.set_visible(False)
ax.tick_params(length=0)
ax.set_xlabel('Time of Day', fontsize=11, color='#374151', labelpad=10)
ax.set_title('API Response Time by Endpoint', fontsize=16, color='#111827', fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Heatmaps & Density
More Heatmap examples
☕