Stripplot和boxplot异常值不重叠

时间:2018-04-06 15:20:46

标签: python-3.x seaborn boxplot

我一直在将箱线图和stripplot与seaborn结合起来,我注意到箱线图异常值通常具有较大的值,即stripplot显示的最大值。怎么会这样?箱线图异常值以及stripplot应该是真正的数据点吗?

这是我用来生成图表的代码:

data_long = pd.melt(data, id_vars=['var'])
sns.boxplot(x='value', y='var', data=data_long, hue='variable', orient='h',
                 order=sorted(values), palette='Set3')
sns.stripplot(x='value', y='var', data=data_long, hue='variable', orient='h', dodge=True, palette='Set3',
                  edgecolor='black', linewidth=1, jitter=True)
plt.semilogx(basex=2)

以下是示例: enter image description here

有人知道发生了什么吗?

最高的问候。

1 个答案:

答案 0 :(得分:0)

由于我正在使这个问题变得更好,试图摆脱-1,我注意到我只在箱图中有order=(values),这使得箱子和stripplot之间的数据不同。将order参数也添加到stripplot可以解决问题。

相关问题