Heatmap
Code Review Metrics Matrix
Seamless heatmap of code review statistics by reviewer and repository
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
fig, ax = plt.subplots(figsize=(12, 8), facecolor='#ffffff')
ax.set_facecolor('#ffffff')
np.random.seed(42)
reviewers = ['@alice', '@bob', '@carol', '@david', '@emma', '@frank']
repos = ['frontend', 'backend', 'api', 'mobile', 'infra', 'docs', 'tests']
data = np.random.randint(0, 50, (len(reviewers), len(repos)))
# Modern gradient: Slate to Cyan (GitHub-inspired)
colors = ['#f1f5f9', '#94a3b8', '#475569', '#0f172a', '#06b6d4']
cmap = LinearSegmentedColormap.from_list('modern', colors, N=256)
im = ax.imshow(data, cmap=cmap, aspect='auto')
ax.set_xticks(range(len(repos)))
ax.set_yticks(range(len(reviewers)))
ax.set_xticklabels(repos, rotation=45, ha='right', color='#374151', fontsize=10)
ax.set_yticklabels(reviewers, color='#1f2937', fontsize=10, fontweight='500', family='monospace')
for i in range(len(reviewers)):
for j in range(len(repos)):
val = data[i, j]
color = '#ffffff' if val > 25 else '#1f2937'
ax.text(j, i, f'{val}', ha='center', va='center', color=color, fontsize=11, fontweight='bold')
cbar = plt.colorbar(im, ax=ax, shrink=0.8, pad=0.02)
cbar.set_label('Reviews Completed', color='#1f2937', fontsize=11)
cbar.outline.set_edgecolor('#e5e7eb')
plt.setp(plt.getp(cbar.ax.axes, 'yticklabels'), color='#6b7280')
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
ax.set_title('Code Review Activity by Repository', fontsize=16, color='#111827', fontweight='bold', pad=15)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Heatmaps & Density
More Heatmap examples
☕