在seaborn barplot xaxis python中换行

2024-04-18 18:44:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图绘制一个数据帧,我希望x轴标签不要像这里那样互相覆盖

enter image description here

当处理一个绘图时,添加.set_xticklabels(rotation=30)可以解决问题:

sns.catplot("foo", data=boo, aspect=5, kind="count" ).set_xticklabels(rotation=30)

enter image description here

但是当我添加ax参数时:

^{pr2}$

它没有(见第一个快照)。在

我试过sns.catplot("foo", data=boo, aspect=5, kind="count", ax=ax1).set_xticklabels(rotation=30)

我在找某种excel的“换行文字”。我试着寻找海生属性,但没有成功。我还试图使x轴的值更小,但它仍然覆盖了一些标签中的每个值。在


Tags: 数据datafoocount绘制标签axset