Pandas xlabel 不显示值

问题描述:

我有一个熊猫数据框

jul.head()

其中包含

但是,当我尝试绘制数据时,无法弄清楚如何在绘图中显示索引值(小群大小,中大群大小...).我用

However, when I try to plot my data, I can't figure out how to show my index values (small swarm size, medium high swarm size, ...) in my plot. I use

jul.plot(y='value', label='july').set_xlabel("config name", fontsize=12)

这给了我:

我不知道如何在图中显示索引值.有任何想法吗?

I can't figure out how to show the index values in the plot. Any ideas?

谢谢

以下应该做:

df1=pd.DataFrame({'config name':['small', 'medium', 'large'], 'value':[-.000127, .000169, -.000206]})
plt.plot(df1.iloc[:,0], df1.iloc[:,1])
plt.xlabel('Config name')
plt.ylabel('Value')
plt.legend('Value')