在一个轴上绘制数据框列,在同一图上将其他列绘制为单独的线(不同颜色)

plot dataframe column on one axis and other columns as separate lines on the same plot (in different color)

我有以下数据框。

        precision    recall        F1  cutoff
cutoff                                       
0        0.690148  1.000000  0.814610       0
1        0.727498  1.000000  0.839943       1
2        0.769298  0.916667  0.834051       2
3        0.813232  0.916667  0.859741       3
4        0.838062  0.833333  0.833659       4
5        0.881454  0.833333  0.854946       5
6        0.925455  0.750000  0.827202       6
7        0.961111  0.666667  0.786459       7
8        0.971786  0.500000  0.659684       8
9        0.970000  0.166667  0.284000       9
10       0.955000  0.083333  0.152857      10

我想在 x 轴上绘制截断列,将精度、召回率和 F1 值绘制为同一图上的不同线条(不同颜色)。我该怎么做?

当我尝试绘制数据框时,它也在使用截断列进行绘制。

谢谢

绘图前删除列:

df.drop('cutoff', axis=1).plot()

但也许问题是如何创建的index,也许帮助更改:

df = df.set_index(df['cutoff'])
df.drop('cutoff', axis=1).plot()

至:

df = df.set_index('cutoff')
df.plot()