ANOVA Boxplot
Container Runtime Startup ANOVA
Comparing container cold start times across different runtimes.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
np.random.seed(777)
# Startup time in milliseconds
docker = np.random.lognormal(5.5, 0.4, 120)
containerd = np.random.lognormal(5.2, 0.35, 120)
podman = np.random.lognormal(5.4, 0.38, 120)
crio = np.random.lognormal(5.3, 0.36, 120)
docker = np.clip(docker, 100, 800)
containerd = np.clip(containerd, 80, 600)
podman = np.clip(podman, 90, 700)
crio = np.clip(crio, 85, 650)
F_stat, p_value = stats.f_oneway(docker, containerd, podman, crio)
fig, ax = plt.subplots(figsize=(12, 7), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')
colors = ['#27D3F5', '#F5276C', '#F5B027', '#6CF527']
data = [docker, containerd, podman, crio]
bp = ax.boxplot(data, positions=[1, 2, 3, 4], widths=0.6, patch_artist=True,
medianprops={'color': 'white', 'linewidth': 2},
whiskerprops={'color': '#555555', 'linewidth': 1.5},
capprops={'color': '#555555', 'linewidth': 1.5},
flierprops={'marker': '.', 'markerfacecolor': '#666666', 'markersize': 5})
for patch, color in zip(bp['boxes'], colors):
patch.set_facecolor(color)
patch.set_alpha(0.7)
patch.set_edgecolor('white')
patch.set_linewidth(1.5)
labels = ['Docker', 'containerd', 'Podman', 'CRI-O']
# P50 and P99 annotations
for i, (d, color) in enumerate(zip(data, colors)):
p50 = np.percentile(d, 50)
p99 = np.percentile(d, 99)
ax.text(i+1, 30, f'P50:{p50:.0f} P99:{p99:.0f}', ha='center', fontsize=8, color=color)
# K8s integration indicator
k8s = ['Via API', 'Native', 'Via API', 'Native']
for i, (k, color) in enumerate(zip(k8s, colors)):
ax.text(i+1, 850, k, ha='center', fontsize=8, color=color, fontweight='bold')
# Stats header
stats_text = f"ANOVA: F={F_stat:.2f}, p={p_value:.4f} | Fastest: containerd (P50={np.percentile(containerd,50):.0f}ms)"
bbox = dict(boxstyle="round,pad=0.3", facecolor='#0d1117', edgecolor='#F5276C', lw=2)
ax.text(0.5, 1.02, stats_text, transform=ax.transAxes, fontsize=9, color='white',
ha='center', va='bottom', fontfamily='monospace', bbox=bbox)
ax.set_xticks([1, 2, 3, 4])
ax.set_xticklabels(labels, fontsize=11, color='white')
ax.set_ylabel('Cold Start Time (ms)', fontsize=12, color='white', fontweight='500')
ax.set_title('Container Runtime Performance\nCold Start Benchmark',
fontsize=14, color='white', fontweight='bold', pad=25)
ax.tick_params(colors='#888888')
for spine in ax.spines.values():
spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_axisbelow(True)
ax.set_ylim(0, 900)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More ANOVA Boxplot examples
☕