This question already has answers here:
Rotate label text in seaborn factorplot
                                
                                    (6个答案)
                                
                        
                                3年前关闭。
            
                    
我想解决一个海洋图中的标签问题,我在x轴上有30多个项目。如何减小标签尺寸或可旋转图形?

python - 标注尺寸或旋转python seaborn图-LMLPHP

import seaborn as sns
g = sns.factorplot(x="target", data=df3, kind="count",
                   palette="BuPu", size=6, aspect=1.5)

最佳答案

如果在Jupyter中的单个单元格中执行,这将起作用:

g = sns.factorplot(x="target", data=df3, kind="count",
                   palette="BuPu", size=6, aspect=1.5)
g.set(xticks=np.arange(0, 40, 3))  # or however many you have
plt.xticks(rotation=90);


如果在Spyder中作为一个块执行,它也将起作用。

10-07 17:51