如何显示 pandas 数据框图形的 x 轴标签

How to display x-axis labels for graph of pandas dataframe

这段代码应该给出 x 轴标签,但它没有。

我是 运行 jupyter 中的代码,代码如下:

df = pd.DataFrame({
'Precision': [0.0983, 0.2936, 0.3992, 0.4016, 0.1360],
'Recall': [0.8495, 0.3312, 0.3065, 0.0995, 0.1071],
'F1': [0.1763, 0.3113, 0.3467, 0.1595, 0.1198]
}, index=['EDbase', 'ED + i1', 'ED +i2', 'ED +i3', 'ED +i4'])
lines = df.plot.line()

为什么它不显示 x 轴标签,我该如何解决这个问题?

图片

冠军来了 -

df = pd.DataFrame({
'Precision': [0.0983, 0.2936, 0.3992, 0.4016, 0.1360],
'Recall': [0.8495, 0.3312, 0.3065, 0.0995, 0.1071],
'F1': [0.1763, 0.3113, 0.3467, 0.1595, 0.1198]
}, index=['EDbase', 'ED + i1', 'ED +i2', 'ED +i3', 'ED +i4'])
lines = df.plot.line()

# Something to remember
plt.xticks(np.arange(5), df.index)
plt.show()