【发布时间】:2019-02-13 12:12:43
【问题描述】:
我的目标是生成一个箱线图,以可视化 Treat1、Treat2、Treat3 和 Treat4 中值的分布。
我可以得到一个条形图来得到我想要的基于 How to add group labels for bar charts in matplotlib?
但是,我的要求是使用箱线图查看每个处理组的均值和异常值之间的分布。 我再次粘贴代码,该代码生成基于stackoverflow代码https://stackoverflow.com/users/2846871/varicus的条形图@
df = df2.groupby(['Group','Category','Day ']).sum()
fig = plt.figure(figsize=(20,8))
ax = fig.add_subplot(111)
df.plot(kind='bar',stacked=False,ax=fig.gca())
labels = ['' for item in ax.get_xticklabels()]
ax.set_xticklabels(labels)
ax.set_xlabel('')
label_group_bar_table(ax, df)
fig.subplots_adjust(bottom=.1*df.index.nlevels)
plt.show()
生成箱线图而不是每个条形图的最佳方法是什么。
【问题讨论】:
-
你看到this question了吗?
标签: matplotlib seaborn boxplot