Faceted Scatter Plot
Social Media Metrics by Channel
Social media content performance across digital channels
Output
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
np.random.seed(777)
platforms = ['Instagram', 'TikTok', 'YouTube', 'Twitter']
data = []
for plat in platforms:
n = 45
followers = np.random.uniform(1000, 1000000, n)
engagement_rates = {'Instagram': 0.035, 'TikTok': 0.055, 'YouTube': 0.025, 'Twitter': 0.02}
engagement = engagement_rates[plat] * np.log10(followers) * 100 + np.random.normal(0, 0.8, n)
for f, e in zip(followers, engagement):
data.append({'Followers': f, 'Engagement Rate (%)': e, 'Platform': plat})
df = pd.DataFrame(data)
df['Log Followers'] = np.log10(df['Followers'])
sns.set_style("whitegrid", {
'axes.facecolor': '#ffffff',
'figure.facecolor': '#ffffff',
'grid.color': '#eeeeee'
})
palette = ['#F527B0', '#27F5B0', '#F54927', '#27D3F5']
g = sns.lmplot(
data=df,
x='Log Followers',
y='Engagement Rate (%)',
hue='Platform',
col='Platform',
col_wrap=2,
height=3.5,
aspect=1.2,
palette=palette,
scatter_kws={'alpha': 0.7, 's': 50, 'edgecolor': 'white', 'linewidths': 0.6},
line_kws={'linewidth': 2.5},
ci=95
)
g.fig.set_facecolor('#ffffff')
for ax in g.axes.flat:
ax.set_facecolor('#ffffff')
for spine in ax.spines.values():
spine.set_color('#dddddd')
g.fig.suptitle('Social Media Engagement Scaling', fontsize=14, fontweight='bold', color='#1a1a1a', y=1.02)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Faceted Scatter Plot examples
☕