Area Chart

System Monitor

Real-time style CPU and memory usage.

Output
System Monitor
Python
import matplotlib.pyplot as plt
import numpy as np

# Data - System metrics
np.random.seed(42)
time = np.arange(0, 60)
cpu = 30 + 20*np.sin(time/10) + np.random.normal(0, 5, len(time))
cpu = np.clip(cpu, 0, 100)
memory = 45 + 10*np.sin(time/15 + 1) + np.random.normal(0, 3, len(time))
memory = np.clip(memory, 0, 100)

# Figure - DARK THEME
fig, ax = plt.subplots(figsize=(10, 5), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

# CPU and Memory with NEON colors
ax.fill_between(time, 0, cpu, alpha=0.4, color='#27D3F5', label='CPU')
ax.fill_between(time, 0, memory, alpha=0.3, color='#F5276C', label='Memory')
ax.plot(time, cpu, color='#27D3F5', linewidth=1.5)
ax.plot(time, memory, color='#F5276C', linewidth=1.5)

# Threshold line
ax.axhline(80, color='#F5B027', linewidth=1.5, linestyle='--', alpha=0.7, label='Alert threshold')

# Current values annotation
ax.text(0.98, 0.95, f'CPU: {cpu[-1]:.0f}%', transform=ax.transAxes, color='#27D3F5', 
        fontsize=12, fontweight='bold', ha='right', va='top')
ax.text(0.98, 0.85, f'MEM: {memory[-1]:.0f}%', transform=ax.transAxes, color='#F5276C', 
        fontsize=12, fontweight='bold', ha='right', va='top')

# Styling
ax.set_xlabel('Seconds', color='white', fontsize=11)
ax.set_ylabel('Usage (%)', color='white', fontsize=11)
ax.set_title('System Resource Monitor', color='white', fontsize=14, fontweight='bold', pad=15)
ax.tick_params(colors='#888888', labelsize=9)
for spine in ax.spines.values():
    spine.set_color('#333333')
ax.yaxis.grid(True, color='#1a1a2e', linewidth=0.5)
ax.set_xlim(0, 60)
ax.set_ylim(0, 100)
ax.legend(facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white', loc='upper left')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support