箱线图和线之间的平均值不匹配

时间:2019-06-24 16:58:10

标签: python pandas boxplot

我目前正在使用python 3在同一张图中绘制一些箱形图。我正在使用熊猫,遇到了严重的问题。通过使用seaborn手动绘制均值,我发现它们与盒图中的不匹配。

我用Excel手动计算了一些均值(和中位数),发现Seaborn的均值是正确的。

from IPython import get_ipython
get_ipython().magic('reset -sf')
import pandas
import matplotlib.pyplot as p
import seaborn as sns
frm = pandas.read_csv('weg.csv',sep =',')
weg3=frm.head(1740)
p.figure(1)

fig, axes = p.subplots(nrows=1, ncols=2, sharey=False)
#Plot Weg3
bp = weg3.boxplot(column=['Multis'],by='UID', ax=axes[0], vert=False, showmeans=True, meanline=True)
sns.pointplot(y='UID', x='Multis', data=weg3.groupby('UID', as_index=False).mean(), ax=bp, markers='')

0 个答案:

没有答案