python - 如何更改 seaborn barplot 的大小?
问题描述
我想调整条形图的大小以很好地适应我的数据。
我试过了:
ax = sns.barplot(x=b1_df2.score/(-2), y='CountryCode', hue='question_code', data=b1_df2.loc[b1_df2.answer == 'Very widespread'])
plt.xlabel("Questions")
plt.ylabel("%")
plt.title("Title (very widespread)")
plt.figure(figsize=(50,10))
无论 figsize 参数如何,都没有看到任何效果。
帮助将不胜感激。
解决方案
如果您想在之后更改大小,请执行以下操作:
plt.gcf().set_size_inches(50,10)
或者:
ax.figure.set_size_inches(50,10)
推荐阅读
- angular - 如何模拟来自服务 Angular 7 的可观察值?
- git - 更改文件时如何在 github 存储库中设置挂钩?
- vba - 删除隐藏的书签中包含的文本
- amazon-web-services - Amazon CloudSearch 重音词
- git - Git amend - 看不到修改子分支上已提交更改的更改
- python - window.stop() 通过 execute_script() 在 chromedriver 中不起作用,但在 geckodriver 中起作用
- python - 当用 c 扩展 python 时,如何处理任意大小的整数?
- javascript - Vue,我在组件上使用了 $mount(),有没有办法 $unmount() 引用?
- html - 在 Bootstrap 中,为什么无效反馈类会增加我输入的宽度?
- javascript - API 网关返回 403 - 禁止