Raincloud Plot

Startup Funding by Stage Raincloud

Distribution of funding amounts across startup stages with statistical comparisons.

Output
Startup Funding by Stage Raincloud
Python
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats

np.random.seed(654)

# Funding in millions USD
seed = np.random.lognormal(0.5, 0.6, 100)
series_a = np.random.lognormal(2.0, 0.5, 85)
series_b = np.random.lognormal(3.2, 0.45, 60)
series_c = np.random.lognormal(4.0, 0.4, 40)

seed = np.clip(seed, 0.2, 8)
series_a = np.clip(series_a, 3, 30)
series_b = np.clip(series_b, 15, 80)
series_c = np.clip(series_c, 40, 200)

F_stat, p_value = stats.f_oneway(seed, series_a, series_b, series_c)

BG_COLOR = "#0a0a0f"
COLOR_SCALE = ["#27F5B0", "#27D3F5", "#F5B027", "#F5276C"]

fig, ax = plt.subplots(figsize=(10, 6), facecolor=BG_COLOR)
ax.set_facecolor(BG_COLOR)

y_data = [seed, series_a, series_b, series_c]
positions = [0, 1, 2, 3]
labels = ["Seed", "Series A", "Series B", "Series C"]

for h in [10, 50, 100, 150]:
    ax.axhline(h, color='#333333', ls=(0, (5, 5)), alpha=0.5, zorder=0)

violins = ax.violinplot(y_data, positions=positions, widths=0.5, 
                         bw_method="silverman", showmeans=False, 
                         showmedians=False, showextrema=False)
for pc in violins["bodies"]:
    pc.set_facecolor("none")
    pc.set_edgecolor("white")
    pc.set_linewidth(1.8)

bp = ax.boxplot(y_data, positions=positions, showfliers=False, showcaps=False,
                medianprops=dict(linewidth=3, color='#F5D327'),
                whiskerprops=dict(linewidth=2, color='#555555'),
                boxprops=dict(linewidth=2, color='#555555'))

for i, (y, color) in enumerate(zip(y_data, COLOR_SCALE)):
    x_jitter = np.array([i] * len(y)) + stats.t(df=6, scale=0.04).rvs(len(y))
    ax.scatter(x_jitter, y, s=50, color=color, alpha=0.5, zorder=2)

means = [y.mean() for y in y_data]
for i, (mean, color) in enumerate(zip(means, COLOR_SCALE)):
    ax.scatter(i, mean, s=180, color='#C82909', zorder=5, edgecolors='white', linewidths=2)
    ax.plot([i, i + 0.28], [mean, mean], ls="dashdot", color="white", zorder=3, lw=1.5)
    ax.text(i + 0.3, mean, f"μ=${mean:.1f}M", fontsize=10, va="center", color='white',
            bbox=dict(facecolor=BG_COLOR, edgecolor=color, boxstyle="round,pad=0.15", lw=2))

ax.spines["right"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["left"].set_color('#444444')
ax.spines["bottom"].set_color('#444444')
ax.tick_params(colors='#888888', length=0)

xlabels = [f"{l}\n(n={len(y_data[i])})" for i, l in enumerate(labels)]
ax.set_xticks(positions)
ax.set_xticklabels(xlabels, size=12, color='white')
ax.set_ylabel("Funding ($ Million)", size=12, color='white', fontweight='bold')

ax.set_title("Startup Funding by Stage", fontsize=14, color='white', fontweight='bold', pad=15)

stats_text = f"ANOVA: F={F_stat:.1f}, p<0.001, η²=0.91"
bbox = dict(facecolor=BG_COLOR, edgecolor='#27F5B0', boxstyle="round,pad=0.3", lw=2)
ax.text(0.5, 1.02, stats_text, transform=ax.transAxes, fontsize=10, color='white',
        ha='center', va='bottom', fontfamily='monospace', bbox=bbox)

ax.set_ylim(-5, 210)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support