Raincloud Plot
Customer Satisfaction by Service Channel
NPS scores across different support channels
Output
Python
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import ptitprince as pt
np.random.seed(103)
BG_COLOR = '#0a0a0f'
TEXT_COLOR = 'white'
COLORS = ['#F54927', '#27D3F5', '#D3F527', '#F527B0']
channels = ['Phone', 'Chat', 'Email', 'Self-Service']
data = pd.DataFrame({
'NPS': np.concatenate([
np.random.normal(72, 15, 120),
np.random.normal(78, 12, 150),
np.random.normal(65, 18, 100),
np.random.normal(58, 20, 80)
]),
'Channel': ['Phone']*120 + ['Chat']*150 + ['Email']*100 + ['Self-Service']*80
})
fig, ax = plt.subplots(figsize=(10, 6), facecolor=BG_COLOR)
ax.set_facecolor(BG_COLOR)
pt.RainCloud(x='Channel', y='NPS', data=data, palette=COLORS,
bw=.2, width_viol=.6, ax=ax, orient='h', alpha=.65,
dodge=True, pointplot=False, move=.2)
ax.set_xlabel('NPS Score', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_ylabel('Service Channel', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_title('Customer Satisfaction by Channel', fontsize=14, color=TEXT_COLOR, fontweight='bold', pad=15)
ax.tick_params(colors='#888', labelsize=10)
for spine in ax.spines.values():
spine.set_color('#333')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Raincloud Plot examples
☕