from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
df = pd.DataFrame({})
df[soi_name]=soi
df[outcome_name]=outcome
soi,outcome = utils.format_cols(soi, outcome,'continuous',agg_method)
sns.factorplot(data=df, x=outcome_name,y=soi_name,hue=outcome_name,kind='box')
plt.savefig(ofilepath)
因此,用于生成此箱线图的代码片段位于上方。outcome是一个二元浮点型pandas序列,soi是一个浮点型pandas序列。这个x轴的偏移发生在箱线图和小提琴图中。当我使用以下代码生成因子图时:
df = pd.DataFrame({})
df[soi_name]=soi
df[outcome_name]=outcome
sns.factorplot(data=df, x=outcome_name,y=soi_name,hue=outcome_name)
plt.savefig(ofilepath)
我得到了我想要的输出。有任何想法为什么箱线图的移动会发生?