mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.59k stars 1.93k forks source link

Proposal for Beeswarm to overlap points when out of space #3744

Open tvarovski opened 3 months ago

tvarovski commented 3 months ago

Added option (keep_gutters) to Beeswarm plots (swarmplot, catplot) which when set to False, will iteratively decrease the distance between the points by 10% until no more gutters are present.

Example 1

plt.figure(figsize=(4, 4)) # set figure size
swarmplot(data=tips, x="size", y="total_bill", hue="size", alpha=0.7, palette='viridis', keep_gutters=False)

betterbeeswarm

Example 2

catplot(
    data=tips, kind="swarm", x="time", y="total_bill", hue="sex",
    col="day", aspect=0.6, height=2.5, alpha=0.7, size=5, keep_gutters=False)

betterbeeswarm_cat

EwoutH commented 3 months ago

I think this would be a great option to have in Seaborn!