如何避免某些 xticks 自动隐藏在 Pandas 中? [英] How to avoid some xticks are auto-hidden in pandas?

查看:47
本文介绍了如何避免某些 xticks 自动隐藏在 Pandas 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含18行和4列的数据框.现在,我将其绘制并将其索引用作xticks,因此我将执行以下操作:

I have a dataframe which contains 18 rows and 4 columns. Now I would to plot it and use its index as xticks, so I do the following:

ax0 = dfVariableImportance.plot()
ax0.set_xticklabels(dfVariableImportance.index.tolist(), rotation='vertical', visible=True)
plt.show()

原来,有些xtick是自动隐藏的:应该有18个xtick,但是只显示了9个(似乎是自动隐藏的).

It turns out that some xticks are hidden automatically: there should be 18 xticks, but only 9 of them are shown (seems to be hidden automatically).

我如何显示所有18个xticks?

How can I show all the 18 xticks?

推荐答案

您应该能够在dataframe.plot()

You should be able to do this in dataframe.plot()

dfVariableImportance.plot(xticks=dfVariableImportance.index)

这篇关于如何避免某些 xticks 自动隐藏在 Pandas 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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