Correlogram

Athletic Performance Metrics

Sports science correlogram of physiological measurements by athlete type

Output
Athletic Performance Metrics
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

np.random.seed(456)

n = 160
athlete_types = np.random.choice(['Sprinter', 'Endurance', 'Power'], n)
data = {
    'VO2max': np.where(athlete_types == 'Endurance', np.random.normal(65, 5, n),
                      np.where(athlete_types == 'Sprinter', np.random.normal(50, 4, n), np.random.normal(45, 5, n))),
    'Power (W/kg)': np.where(athlete_types == 'Power', np.random.normal(18, 2, n),
                            np.where(athlete_types == 'Sprinter', np.random.normal(15, 2, n), np.random.normal(12, 1.5, n))),
    'Lactate (mmol)': np.random.normal(4, 1.5, n),
    'HR Max': np.random.normal(185, 10, n),
    'Type': athlete_types
}
df = pd.DataFrame(data)

plt.style.use('dark_background')
sns.set_style("darkgrid", {'axes.facecolor': '#0a0a0f', 'figure.facecolor': '#0a0a0f', 'grid.color': '#333333'})

palette = {'Sprinter': '#F5276C', 'Endurance': '#27D3F5', 'Power': '#F5D327'}

g = sns.pairplot(
    df,
    hue='Type',
    palette=palette,
    height=2,
    kind='scatter',
    diag_kind='hist',
    markers=['o', 's', 'D'],
    plot_kws={'alpha': 0.75, 's': 55, 'edgecolor': 'white', 'linewidths': 0.5},
    diag_kws={'alpha': 0.6, 'edgecolor': 'white', 'linewidth': 0.5}
)

g.fig.set_facecolor('#0a0a0f')
for ax in g.axes.flat:
    if ax:
        ax.set_facecolor('#0a0a0f')
        for spine in ax.spines.values():
            spine.set_color('#333333')
        ax.tick_params(colors='#888888')
        ax.xaxis.label.set_color('white')
        ax.yaxis.label.set_color('white')

g.fig.suptitle('Athlete Physiological Profiles', fontsize=14, fontweight='bold', color='white', y=1.02)
plt.setp(g._legend.get_title(), color='white')
plt.setp(g._legend.get_texts(), color='white')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support