Hexbin Plot

CPU GPU Utilization

System performance hexbin showing CPU vs GPU usage correlation

Output
CPU GPU Utilization
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

np.random.seed(444)
cpu = np.random.beta(2, 5, 6000) * 100
gpu = cpu * 0.6 + np.random.beta(2, 3, 6000) * 40

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

colors = ['#0c0c0c', '#1a1a2e', '#16213e', '#1a4a6e', '#1e7a9e', '#22aace', '#44ccff', '#88ddff']
cmap = LinearSegmentedColormap.from_list('cyan', colors, N=256)

hb = ax.hexbin(cpu, gpu, gridsize=30, cmap=cmap, mincnt=1, edgecolors='none')

cbar = plt.colorbar(hb, ax=ax, pad=0.02, shrink=0.8)
cbar.ax.set_facecolor('#0c0c0c')
cbar.outline.set_edgecolor('#1a4a6e')
cbar.ax.tick_params(colors='#44ccff', labelsize=9)
cbar.set_label('Samples', color='#44ccff', fontsize=10)

ax.set_xlabel('CPU Usage (%)', color='#44ccff', fontsize=11)
ax.set_ylabel('GPU Usage (%)', color='#44ccff', fontsize=11)
ax.tick_params(colors='#44ccff', labelsize=10)
ax.set_xlim(0, 100)
ax.set_ylim(0, 100)
for spine in ax.spines.values():
    spine.set_visible(False)

plt.tight_layout()
Library

Matplotlib

Category

Pairwise Data

Did this help you?

Support PyLucid to keep it free & growing

Support