【发布时间】:2019-11-24 18:13:54
【问题描述】:
我正在基于这个 Kaggle kernel 处理泰坦尼克号数据集。在我尝试使用 barplot 函数的部分,它给了我一条警告消息 UserWarning: Using the barplot function without specifying order 可能会产生不正确的绘图。
我应该担心吗?
我已尝试指定 order 参数和 hue_order。
grid = sns.FacetGrid(train_df, col='Embarked', row='Survived', height=2.2, aspect=1.6)
grid.map(sns.barplot, 'Sex', 'Fare', alpha=0.5, ci=None, order=[1,2,3], hue_order=['Embarked', 'Survived'])
grid.add_legend()
当我指定 order 和 hue_order 时,它给了我空的条形图。 empty barplots
但是,当我取出 order 和 hue_order 时,它确实给了我带有此警告消息的图:
C:\Users\user\Anaconda3\lib\site-packages\seaborn\axisgrid.py:715: UserWarning: Using the barplot function without specifying `order` is likely to produce an incorrect plot.
warnings.warn(warning)
有什么我应该知道的想法或提示吗?提前致谢!
【问题讨论】:
-
我无法在您的代码中发现任何错误。您是否已经尝试过
plt.show()命令?有时它可能会影响结果.... -
@cyber-math 我做了,它给了我结果,但仍然有相同的警告信息。