How to create a swarm plot with matplotlib

后端 未结 1 993
-上瘾入骨i
-上瘾入骨i 2020-12-11 03:51

I know the question is not very informative.. but as I do not know the name of his type of plot, I can not be more informative..

[EDIT] I changed the title,

相关标签:
1条回答
  • 2020-12-11 04:16

    You can do something similar with seaborn.swarmplot. I also use seaborn.boxplot (with the whiskers and caps turned off) to plot the mean and range:

    import matplotlib.pyplot as plt
    import seaborn as sns
    sns.set_style("whitegrid")
    tips = sns.load_dataset("tips")
    ax = sns.swarmplot(x="day", y="total_bill", data=tips)
    ax = sns.boxplot(x="day", y="total_bill", data=tips,
            showcaps=False,boxprops={'facecolor':'None'},
            showfliers=False,whiskerprops={'linewidth':0})
    
    plt.show()
    

    0 讨论(0)
提交回复
热议问题