【发布时间】:2020-09-20 09:35:49
【问题描述】:
我正在尝试在 Python 中为如下所示的 DataFrame 创建一个点图/ggplot:
layers_time = {'2 layers': [20.6885, 25.1765, 18.7503, 19.2090, 19.2548],
'3 layers': [20.4360, 27.5285, 20.1958, 18.9536, 20.1673],
'4 layers': [18.1703, 21.9665, 17.0667, 17.3353, 16.2638],
'5 layers': [19.3265, 25.7931, 17.9827, 18.5448, 18.8970],
'6 layers': [19.7180, 24.7097, 20.7460, 19.7300, 18.2760]
}
layers_time = pd.DataFrame(layers_time, columns=['2 layers', '3 layers',
'4 layers', '5 layers', '6 layers'])
我想要的只是将列名作为 x 值,并将它们对应的值作为 y 轴上的点。
另外,是否有一种聪明的方法可以将这些值的平均值包含为具有不同颜色的点?
我尝试过类似问题的答案,但由于 x 和 y 尺寸不同,它们不起作用?
【问题讨论】:
标签: python pandas matplotlib plot seaborn