Correlogram

Social Network Metrics

User engagement correlogram across platform types

Output
Social Network Metrics
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

np.random.seed(333)

n = 170
platforms = np.random.choice(['Professional', 'Social', 'Content'], n)
data = {
    'Followers (K)': np.where(platforms == 'Content', np.random.lognormal(3, 1, n),
                             np.where(platforms == 'Social', np.random.lognormal(2.5, 1.2, n), np.random.lognormal(1.5, 0.8, n))),
    'Posts/Day': np.where(platforms == 'Content', np.random.normal(2, 0.8, n),
                         np.where(platforms == 'Social', np.random.normal(5, 2, n), np.random.normal(0.5, 0.2, n))),
    'Engagement (%)': np.where(platforms == 'Professional', np.random.normal(3, 1, n),
                              np.where(platforms == 'Social', np.random.normal(5, 2, n), np.random.normal(8, 3, n))),
    'Reach (K)': np.random.lognormal(2, 1, n),
    'Platform': platforms
}
df = pd.DataFrame(data)

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

palette = {'Professional': '#276CF5', 'Social': '#F527B0', 'Content': '#F5D327'}

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

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('Platform Engagement Analysis', 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