python - python:seaborn lineplot根据列的值自定义标记大小
问题描述
我有如下数据:
#df
df = pd.DataFrame({
'id': {0: -3, 1: 2, 2: -3, 3: 1},
'val': {0: 0.4, 1: 0.03, 2: 0.88, 3: 1.3},
'indicator': {0: 'A', 1: 'A', 2: 'B', 3: 'B'},
'count': {0: 40000, 1: 5779, 2: 3000, 3: 31090}
})
df
如果我执行以下代码,我将拥有:
sns.relplot(x = 'id', y = 'val', hue = 'indicator', size = 'count', data = df)
我想要一条连接点的线。但是,如果我将绘图更改为线图,我将有任何图表。
sns.lineplot(x = 'id', y = 'val', hue = 'indicator', size = 'count', data = df)
解决方案
推荐阅读
- postgresql - postgresql 根据日期列更新值
- android - 在更新回收器视图列表的数据集时,它的滚动跳回顶部(重复)
- python - 不接收带有 Python 请求的 302 状态码
- react-native - react-native android错误:开发服务器返回响应错误代码:404
- laravel - 在 Laravel Blade 中使用 Trait(组件)
- python - 求解变量子集的多元方程
- ruby-on-rails - Rails 6 alpha:Sprockets::FileNotFound
- c# - 自定义形状您的用户控件或面板
- amazon-web-services - 如何用其他 ec2 实例图像替换 ec2 图像?
- node.js - 未处理的拒绝 MongoError: '$inc' 中的美元 ($) 前缀字段 '$inc' 对存储无效