Ridgeline Plot

Database Query Time by Operation

SQL performance with matrix green cyber aesthetic

Output
Database Query Time by Operation
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

np.random.seed(444)

operations = ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'JOIN', 'AGGREGATE']
# Matrix green variations
colors = ['#6CF527', '#27F5B0', '#27D3F5', '#D3F527', '#6CF527', '#27F5B0']

data = {
    'SELECT': np.random.lognormal(1.5, 0.8, 500),
    'INSERT': np.random.lognormal(1.8, 0.6, 500),
    'UPDATE': np.random.lognormal(2, 0.7, 500),
    'DELETE': np.random.lognormal(1.7, 0.5, 500),
    'JOIN': np.random.lognormal(2.5, 0.9, 500),
    'AGGREGATE': np.random.lognormal(2.8, 1, 500)
}

fig, ax = plt.subplots(figsize=(12, 8), facecolor='#020B14')
ax.set_facecolor('#020B14')

overlap = 1.7
x_range = np.linspace(0, 100, 300)

for i, (op, time) in enumerate(data.items()):
    time = np.clip(time, 0, 100)
    kde = stats.gaussian_kde(time, bw_method=0.3)
    y = kde(x_range) * 4
    baseline = i * overlap
    
    # Matrix glow
    for w, a in [(15, 0.08), (10, 0.12), (6, 0.2), (3, 0.4)]:
        ax.plot(x_range, y + baseline, color=colors[i], linewidth=w, alpha=a)
    
    ax.fill_between(x_range, baseline, y + baseline, alpha=0.4, color=colors[i])
    ax.plot(x_range, y + baseline, color='white', linewidth=1, alpha=0.9)
    
    ax.text(-3, baseline + 0.15, op, fontsize=10, color=colors[i],
            ha='right', va='bottom', fontweight='600', family='monospace')

ax.set_xlim(-20, 100)
ax.set_ylim(-0.3, len(operations) * overlap + 2)
ax.set_xlabel('Query Time (ms)', fontsize=12, color='#555555', fontweight='500')
ax.set_title('Database Query Time by Operation', fontsize=16, color='#6CF527', fontweight='bold', pad=20)

ax.tick_params(axis='x', colors='#444444', labelsize=10)
ax.tick_params(axis='y', left=False, labelleft=False)
for spine in ax.spines.values():
    spine.set_visible(False)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support