python - seaborn swarmplot 中的水平图
问题描述
情况
我有以下熊猫数据集:
|user_id|total|is_fat|
|-------|-----|------|
|1 |100 |1 |
|2 |150 |0 |
|3 |400 |1 |
|4 |500 |1 |
|5 |10 |0 |
其中总的元素是整数,is_fat 的元素是字符串。
我用 表示上述数据集df
。
然后运行以下代码:
import seaborn as sos
sns.swarmplot(x = 'total', y ='is_fat', data = df)
问题 但是,输出图如下:
为什么?
搜索
如果我将 '1' 转换为 'fat' 并将 '0' 转换为 'not_fat',那么我会得到预期的图表。
解决方案
推荐阅读
- django - 在不同的应用程序中单击注销按钮时重定向到登录视图
- google-chrome - 如何在谷歌浏览器的开发者工具控制台中创建和保存文件?
- laravel - 在 Laravel Jetstream / Fortify 中将登录用户重定向到个人资料页面(启用 2 因素)?
- ios - 动态集合视图单元格大小调整无法正常工作
- hadoop - 在 HIVE 中创建数据库时权限被拒绝
- excel - VBA:转换为数字
- react-native - 当视频在 expo-video-player 上以 react native 结束时如何提醒某些东西?
- go - 使用多种方式转换十六进制值会导致不同的输出
- flutter - 在 dart/flutter 中使用 [][] 从包含列表的地图索引错误
- python - 我怎样才能让 tkinter 与 time.sleep 一起工作