KDE Plot
Server CPU Usage Distribution
KDE of CPU utilization patterns across server fleet.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
np.random.seed(59)
# CPU usage percentages (bimodal - idle vs busy)
idle = np.random.beta(2, 8, 400) * 100
active = np.random.beta(5, 3, 600) * 100
cpu = np.concatenate([idle, active])
kde = stats.gaussian_kde(cpu)
x = np.linspace(0, 100, 500)
y = kde(x)
fig, ax = plt.subplots(figsize=(12, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
# Color by utilization level
for i in range(len(x)-1):
if x[i] < 30:
color = '#27D3F5' # Low - cyan
elif x[i] < 60:
color = '#6CF527' # Moderate - lime
elif x[i] < 80:
color = '#F5B027' # High - amber
else:
color = '#F5276C' # Critical - coral
ax.fill_between(x[i:i+2], y[i:i+2], alpha=0.6, color=color)
ax.plot(x, y, color='#27D3F5', linewidth=3)
ax.plot(x, y, color='#27D3F5', linewidth=8, alpha=0.2)
# Threshold lines
ax.axvline(80, color='#F5276C', linestyle='--', linewidth=2, label='Critical (80%)')
ax.axvline(60, color='#F5B027', linestyle='--', linewidth=1.5, alpha=0.7, label='Warning (60%)')
ax.set_xlabel('CPU Usage (%)', fontsize=12, color='white', fontweight='500')
ax.set_ylabel('Density', fontsize=12, color='white', fontweight='500')
ax.set_title('Server CPU Utilization Distribution', fontsize=16, color='white', fontweight='bold', pad=15)
ax.tick_params(colors='white', labelsize=10)
for spine in ax.spines.values():
spine.set_color('#334155')
ax.legend(loc='upper right', facecolor='#1e293b', edgecolor='#334155', labelcolor='white')
ax.grid(True, alpha=0.1, color='white')
ax.set_xlim(0, 100)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
☕