KDE Plot

Gaming Frame Time KDE

Frame time distribution across different GPU tiers in gaming benchmarks

Output
Gaming Frame Time KDE
Python
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde

np.random.seed(111)
BG_COLOR = '#0a0a0f'
TEXT_COLOR = 'white'

# Frame time in ms
high_end = np.random.gamma(2, 3, 600) + 5
mid_range = np.random.gamma(2.5, 5, 600) + 8
budget = np.random.gamma(3, 7, 600) + 12

fig, ax = plt.subplots(figsize=(10, 6), facecolor=BG_COLOR)
ax.set_facecolor(BG_COLOR)

x_range = np.linspace(0, 60, 500)

for data, color, label in [(high_end, '#6CF527', 'High-End GPU'), 
                            (mid_range, '#27D3F5', 'Mid-Range GPU'),
                            (budget, '#F5B027', 'Budget GPU')]:
    data_clipped = data[data < 60]
    kde = gaussian_kde(data_clipped)
    density = kde(x_range)
    ax.plot(x_range, density, color=color, linewidth=2.5, label=label)
    ax.fill_between(x_range, density, alpha=0.3, color=color)

ax.axvline(16.67, color='#F5276C', linestyle='--', alpha=0.8, linewidth=2, label='60 FPS Target')

ax.set_xlabel('Frame Time (ms)', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_ylabel('Density', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_title('Gaming Frame Time Distribution by GPU Tier', fontsize=14, color=TEXT_COLOR, fontweight='bold', pad=15)
ax.set_xlim(0, 60)

ax.tick_params(colors='#888888', labelsize=10)
for spine in ax.spines.values():
    spine.set_color('#333333')
ax.legend(facecolor=BG_COLOR, edgecolor='#333333', labelcolor=TEXT_COLOR, fontsize=10)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support