如何改进这个seaborn countplot? [英] How to improve this seaborn countplot?
本文介绍了如何改进这个seaborn countplot?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码在 python 中使用 seaborn 生成计数图:
I used the following code to generate the countplot in python using seaborn:
sns.countplot( x='Genres', data=gn_s)
但我得到以下输出:
我无法清楚地看到 x 轴上的项目,因为它们重叠.我该如何纠正?此外,我希望所有项目按计数递减顺序排列.我怎样才能做到这一点?
I can't see the items on x-axis clearly as they are overlapping. How can I correct that? Also I would like all the items to be arranged in a decreasing order of count. How can I achieve that?
推荐答案
可以使用选择x轴
为垂直,例如:
You can use choose the x-axis
to be vertical, as an example:
g = sns.countplot( x='Genres', data=gn_s)
g.set_xticklabels(g.get_xticklabels(),rotation=90)
或者,您也可以这样做:
Or, you can also do:
plt.xticks(rotation=90)
这篇关于如何改进这个seaborn countplot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文