Heatmap

Deployment Frequency Heatmap

Light theme heatmap showing deployments by team

Output
Deployment Frequency Heatmap
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.patches import FancyBboxPatch
import matplotlib.patheffects as pe

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

np.random.seed(42)
teams = ['Platform', 'Frontend', 'Backend', 'Mobile', 'Data', 'DevOps']
weeks = [f'W{i+1}' for i in range(12)]
deployments = np.random.poisson(5, (len(teams), len(weeks)))

# Blue-cyan modern gradient
colors = ['#1e293b', '#0c4a6e', '#0891b2', '#22d3ee', '#a5f3fc']
cmap = LinearSegmentedColormap.from_list('modern_blue', colors, N=256)

cell_width = 0.88
cell_height = 0.82
for i in range(len(teams)):
    for j in range(len(weeks)):
        val = deployments[i, j]
        color = cmap(val / deployments.max())
        rect = FancyBboxPatch((j - cell_width/2, i - cell_height/2), 
                               cell_width, cell_height,
                               boxstyle="round,pad=0.02,rounding_size=0.12",
                               facecolor=color, edgecolor='#e2e8f0', linewidth=1.5)
        ax.add_patch(rect)
        # Add value text
        ax.text(j, i, str(val), ha='center', va='center', 
                color='#1e293b' if val > 5 else '#94a3b8', fontsize=10, fontweight='bold')

ax.set_xlim(-0.5, len(weeks) - 0.5)
ax.set_ylim(-0.5, len(teams) - 0.5)
ax.set_aspect('equal')
ax.invert_yaxis()

ax.set_xticks(range(len(weeks)))
ax.set_yticks(range(len(teams)))
ax.set_xticklabels(weeks, color='#64748b', fontsize=10, fontweight='500')
ax.set_yticklabels(teams, color='#1e293b', fontsize=11, fontweight='500')

sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=0, vmax=deployments.max()))
cbar = plt.colorbar(sm, ax=ax, shrink=0.8, aspect=30, pad=0.02)
cbar.set_label('Deployments', color='#1e293b', fontsize=11, fontweight='500')
cbar.ax.yaxis.set_tick_params(color='#64748b')
plt.setp(plt.getp(cbar.ax.axes, 'yticklabels'), color='#64748b')
cbar.outline.set_edgecolor('#e2e8f0')

for spine in ax.spines.values():
    spine.set_visible(False)

ax.set_title('Weekly Deployment Frequency', fontsize=18, color='#1e293b', fontweight='bold', pad=20)
ax.tick_params(length=0)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Heatmaps & Density

Did this help you?

Support PyLucid to keep it free & growing

Support