相关疑难解决方法(0)

来自pandas数据帧的不同大小,标记和颜色的散点图

我正在尝试为每个点做一个速度超过米的散点图,其中标记表示不同的类型,大小表示不同的重量,颜色表示一个点超过10分钟的比例.但是,到目前为止我只能按尺寸绘制.

任何帮助都非常感谢.

x = {'speed': [10, 15, 20, 18, 19], 'meters' : [122, 150, 190, 230, 300], 'type': ['phone', 'phone', 'gps', 'gps', 'car'], 'weight': [0.2, 0.3, 0.1, 0.85, 0.0], 'old': [1, 2, 4, 5, 8]}

m = pd.DataFrame(x)

plt.scatter(m.meters, m.speed, s = 30* m.weight)

mkr_dict = {'gps': 'x', 'phone': '+', 'car': 'o'}

   meters  speed   type  weight  old
0     122     10  phone    0.20    1
1     150     15  phone    0.30    2
2     190     20    gps    0.10    4
3     230     18    gps    0.85 …
Run Code Online (Sandbox Code Playgroud)

python matplotlib scatter-plot marker colorbar

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

colorbar ×1

marker ×1

matplotlib ×1

python ×1

scatter-plot ×1