海底子图X轴标签不旋转
我正在尝试显示带有X轴标签的2个子图,旋转90度。出于某种原因,第一个子图标签没有旋转。谁能让我知道我缺少什么?谢谢!
fig, ax = plt.subplots(1, 2, sharey=True, figsize=(20,10))
fig.suptitle('Top and Bottom Countries by Rating')
plt.xticks(rotation=90)
sns.barplot(data=top_df, y='rating', x='bean_origin', ax=ax[0], palette="Blues_d")
ax[0].set_title('Top 10 Countries by Avg Rating')
sns.barplot(data=bottom_df, y='rating', x='bean_origin', ax=ax[1], palette="Reds_d")
ax[1].set_title('Bottom 10 Countries by Avg Rating')
plt.show()
I'm trying to show 2 subplots with x-axis labels rotated 90 degrees. The first subplot's labels for some reason are not rotating. Can anyone let me know what I'm missing? Thanks!
fig, ax = plt.subplots(1, 2, sharey=True, figsize=(20,10))
fig.suptitle('Top and Bottom Countries by Rating')
plt.xticks(rotation=90)
sns.barplot(data=top_df, y='rating', x='bean_origin', ax=ax[0], palette="Blues_d")
ax[0].set_title('Top 10 Countries by Avg Rating')
sns.barplot(data=bottom_df, y='rating', x='bean_origin', ax=ax[1], palette="Reds_d")
ax[1].set_title('Bottom 10 Countries by Avg Rating')
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试一下:
1。绘制之后致电:如果1次不够,则在每个绘图后尝试添加它,
否则请在下面尝试以下一个解决方案:
2。:
3。
<强> 4。
如果上面没有可行的代码。
注意: imo,45°更好:)
Try this:
1. Call this AFTER plotting: if 1 time not enough, try to add it after each plotting
Otherwise try one of these solutions below:
2. :
3.
4.
If none above works, provide full code.
Note: IMO, 45° is better :)