Area Chart

Memory Allocation Zones

RAM usage by application type with swap threshold

Output
Memory Allocation Zones
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(42)
time = np.arange(0, 60)  # 1 hour in minutes

# Memory usage by type
system = 2 + np.random.normal(0, 0.1, len(time))
apps = 6 + 2*np.sin(time/10) + np.random.normal(0, 0.3, len(time))
cache = 3 + 1.5*np.sin(time/15 + 1) + np.random.normal(0, 0.2, len(time))
buffers = 1 + 0.5*np.sin(time/8) + np.random.normal(0, 0.1, len(time))

fig, ax = plt.subplots(figsize=(10, 6), facecolor='#0a0a0f')
ax.set_facecolor('#0a0a0f')

ax.stackplot(time, system, apps, cache, buffers,
             colors=['#9C2007', '#F5276C', '#27D3F5', '#6CF527'],
             labels=['System', 'Applications', 'Cache', 'Buffers'], alpha=0.85)

# Total RAM line
total_ram = 16
ax.axhline(total_ram, color='#F5B027', linewidth=2, linestyle='--', label='Total RAM (16GB)')
ax.axhline(total_ram * 0.9, color='#F54927', linewidth=1, linestyle=':', alpha=0.7)

ax.set_xlabel('Minutes', color='white', fontsize=11)
ax.set_ylabel('Memory (GB)', color='white', fontsize=11)
ax.set_title('Server Memory Allocation', 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.set_xlim(0, 59)
ax.set_ylim(0, 18)
ax.legend(facecolor='#0a0a0f', edgecolor='#333333', labelcolor='white', loc='upper right')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support