Stackplot

CPU Core Utilization

Multi-core CPU usage over time.

Output
CPU Core Utilization
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'cores': ['#6366F1', '#8B5CF6', '#A855F7', '#C084FC', '#D946EF', '#EC4899', '#F43F5E', '#F97316'],
    'background': '#0F172A',
    'text': '#E2E8F0',
    'grid': '#334155'
}

np.random.seed(42)
t = np.arange(60)
cores = []
for i in range(8):
    base = 30 + 20*np.sin(t/10 + i*0.5) + np.random.normal(0, 5, 60)
    cores.append(np.clip(base, 5, 100))

fig, ax = plt.subplots(figsize=(12, 5), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

ax.stackplot(t, *cores, colors=COLORS['cores'], alpha=0.8,
             labels=[f'Core {i}' for i in range(8)])

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color(COLORS['grid'])
ax.spines['bottom'].set_color(COLORS['grid'])
ax.tick_params(axis='both', colors=COLORS['text'], labelsize=9, length=0, pad=8)
ax.set_xlim(0, 59)
ax.set_xlabel('Time (s)', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Utilization (%)', fontsize=10, color=COLORS['text'], labelpad=10)
ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.15), ncol=8, frameon=False, fontsize=8, labelcolor=COLORS['text'])

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support