[英]Seaborn FacetGrid - Changing y-axis rotation for all plots?
I have used a FacetGRid, and managed to change the rotation of the x-axis for one column, but not the other.我使用了 FacetGRid,并设法更改了一列的 x 轴旋转,但没有更改另一列。 Also is there anyway to get the labels on the x-axis for all the separate plots?
还有是否可以为所有单独的图获取 x 轴上的标签?
I have tried我努力了
grid.set_xticklabels(rotation=65, horizontalalignment='right')
Which completely erases the labels, and这完全擦除了标签,并且
plt.xticks(rotation=90)
Which works fine on the right hand column, but the left column stays the same (see image)在右侧列上工作正常,但左列保持不变(见图)
my code is:我的代码是:
grid = sns.catplot(x='Nationality', y='count', row='Age', col='Gender', hue='Type', data=dfNorthumbria2, kind='bar', ci=None)
Found the answer for the rotation -找到旋转的答案 -
for axes in grid.axes.flat:
axes.set_xticklabels(axes.get_xticklabels(), rotation=65, horizontalalignment='right')
This excellent blog managed to explain it all with relation to using FacetGrid and the columns/rows. 这个优秀的博客设法解释了与使用 FacetGrid 和列/行的关系。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.