Pandas xlabel 不显示值 [英] Pandas xlabel does not show values

查看:75
本文介绍了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')

这篇关于Pandas xlabel 不显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆