首页 > 解决方案 > 如何更改 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 参数如何,都没有看到任何效果。

帮助将不胜感激。

标签: pythonpandasseaborn

解决方案


如果您想在之后更改大小,请执行以下操作:

plt.gcf().set_size_inches(50,10)

或者:

ax.figure.set_size_inches(50,10)

推荐阅读