我看了很多视频,阅读了 Seaborn 文档,查看了很多网站,但我仍然没有找到问题的答案。
这来自 Seaborn 文档:
iris = sns.load_dataset("iris")
ax = sns.boxplot(data=iris, orient="h", palette="Set2")
此代码为单个图形中的每个数值变量创建箱线图。
当我尝试添加 hue= "species" 时,ValueError: Cannot use hue
without x
and y
。有没有办法用 Seaborn 做到这一点?我想查看所有数值变量的箱线图并探索分类变量。因此,该图将显示每个物种的所有数值变量。由于有 3 个物种,箱线图的总数为 12(3 个物种乘以 4 个数值变量)。
我正在学习 EDA(探索性数据分析)。我认为上图将帮助我一次探索许多变量。
感谢您花时间阅读我的问题!