如何使用Matplotlib创建群图 [英] How to create a swarm plot with matplotlib

查看:61
本文介绍了如何使用Matplotlib创建群图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题的信息量不大..但由于我不知道他的情节类型的名称,所以我不能提供更多信息..

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..

我更改了标题,现在内容更丰富...

推荐答案

你可以用 seaborn.swarmplot 做类似的事情.我还使用 seaborn.boxplot (关闭了晶须和盖帽)来绘制平均值和范围:

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()

这篇关于如何使用Matplotlib创建群图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆