Stream Graph

CPU Thread Activity Stream

Stream visualization of CPU thread utilization across multiple cores with cyberpunk aesthetic.

Output
CPU Thread Activity Stream
Python
import matplotlib.pyplot as plt
import numpy as np

COLORS = {
    'background': '#0a0a0f',
    'text': '#ffffff',
    'grid': '#333333',
}

np.random.seed(808)
seconds = np.arange(0, 60)

# CPU threads (8 cores)
core_colors = ['#F5276C', '#F54927', '#F5B027', '#27D3F5', '#27F5B0', '#6CF527', '#4927F5', '#F527B0']

cores = []
for i in range(8):
    phase = i * np.pi / 4
    usage = 20 + 30 * np.sin(seconds * np.pi / 15 + phase) + 20 * np.random.random(60)
    cores.append(np.clip(usage, 5, 100))

fig, ax = plt.subplots(figsize=(14, 6), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])

ax.stackplot(seconds, *cores, colors=core_colors, alpha=0.85, baseline='sym',
             labels=[f'Core {i}' for i in range(8)])

ax.axhline(0, color=COLORS['grid'], linewidth=0.5, alpha=0.5)
ax.set_xlim(0, 59)

ax.set_title('CPU Core Utilization (Real-time)', color=COLORS['text'], fontsize=14, fontweight='bold', pad=15)
ax.set_xlabel('Time (seconds)', color=COLORS['text'], fontsize=11)
ax.set_ylabel('Utilization (%)', color=COLORS['text'], fontsize=11)

ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12), frameon=False, labelcolor=COLORS['text'], fontsize=9, ncol=5)

for spine in ax.spines.values():
    spine.set_visible(False)
ax.tick_params(colors=COLORS['text'], labelsize=9)

plt.tight_layout()
plt.subplots_adjust(bottom=0.18)
plt.show()
Library

Matplotlib

Category

Time Series

Did this help you?

Support PyLucid to keep it free & growing

Support