Correlogram

HR Productivity Correlogram

HR analytics correlogram of productivity indicators by department

Output
HR Productivity Correlogram
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

np.random.seed(222)

n = 170
dept = np.random.choice(['Engineering', 'Sales', 'Marketing'], n)
data = {
    'Productivity': np.where(dept == 'Engineering', np.random.normal(85, 10, n),
                            np.where(dept == 'Sales', np.random.normal(78, 15, n), np.random.normal(80, 12, n))),
    'Satisfaction': np.where(dept == 'Engineering', np.random.normal(72, 12, n),
                            np.where(dept == 'Sales', np.random.normal(68, 15, n), np.random.normal(75, 10, n))),
    'Tenure (yrs)': np.where(dept == 'Engineering', np.random.normal(5, 2, n),
                            np.where(dept == 'Sales', np.random.normal(3, 1.5, n), np.random.normal(4, 1.8, n))),
    'Training (hrs)': np.random.normal(40, 15, n),
    'Department': dept
}
df = pd.DataFrame(data)

sns.set_style("whitegrid", {'axes.facecolor': '#ffffff', 'figure.facecolor': '#ffffff', 'grid.color': '#eeeeee'})

palette = {'Engineering': '#27D3F5', 'Sales': '#F5276C', 'Marketing': '#F5B027'}

g = sns.pairplot(
    df,
    hue='Department',
    palette=palette,
    height=2,
    kind='scatter',
    diag_kind='kde',
    markers=['s', 'o', '^'],
    plot_kws={'alpha': 0.7, 's': 55, 'edgecolor': 'white', 'linewidths': 0.6},
    diag_kws={'alpha': 0.5, 'linewidth': 2.5, 'fill': True}
)

g.fig.set_facecolor('#ffffff')
for ax in g.axes.flat:
    if ax:
        ax.set_facecolor('#ffffff')
        for spine in ax.spines.values():
            spine.set_color('#dddddd')
        ax.tick_params(colors='#666666')
        ax.xaxis.label.set_color('#333333')
        ax.yaxis.label.set_color('#333333')

g.fig.suptitle('Workforce Analytics Dashboard', fontsize=14, fontweight='bold', color='#1a1a1a', y=1.02)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support