Raincloud Plot
Customer Wait Time by Service Type
Queue times across service counters
Output
Python
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import ptitprince as pt
np.random.seed(209)
BG_COLOR = '#ffffff'
TEXT_COLOR = '#1f2937'
COLORS = ['#27D3F5', '#F54927', '#6CF527']
services = ['Express', 'Standard', 'Premium']
data = pd.DataFrame({
'Wait': np.concatenate([
np.random.gamma(2, 2, 120),
np.random.gamma(4, 3, 150),
np.random.gamma(1.5, 1.5, 80)
]),
'Service': ['Express']*120 + ['Standard']*150 + ['Premium']*80
})
fig, ax = plt.subplots(figsize=(10, 6), facecolor=BG_COLOR)
ax.set_facecolor(BG_COLOR)
pt.RainCloud(x='Service', y='Wait', data=data, palette=COLORS,
bw=.2, width_viol=.6, ax=ax, orient='h', alpha=.65,
dodge=True, pointplot=False, move=.2)
ax.axvline(5, color='#ef4444', linestyle='--', alpha=0.6, linewidth=1.5)
ax.text(5.3, 2.5, 'Target', color='#ef4444', fontsize=9)
ax.set_xlabel('Wait Time (minutes)', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_ylabel('Service Type', fontsize=12, color=TEXT_COLOR, fontweight='500')
ax.set_title('Customer Wait Time by Service', fontsize=14, color=TEXT_COLOR, fontweight='bold', pad=15)
ax.tick_params(colors='#374151', labelsize=10)
for spine in ax.spines.values():
spine.set_color('#e5e7eb')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Statistical
More Raincloud Plot examples
☕