首页 > 解决方案 > 调整 Seaborn 图的大小

问题描述

我已经尝试了尽可能多的解决方案,但我在这方面运气不佳。我不确定是不是因为我的一些设置,但我无法重塑我的 Seaborn 计数图。这是我绘制图形的代码:

sns.set_style('whitegrid')
sns.set(font_scale=1.3)
sns.countplot(x=df['QuarterYear'], hue=df['Modifier'])
ax = plt.gca()

for p in ax.patches:
    ax.text(p.get_x() + p.get_width()/2., p.get_height(), '%d' % int(p.get_height()), 
            fontsize=12, color='black', ha='center', va='bottom')

plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)

我还在同一代码块中编辑图例并标记我的计数图列。

我正在使用 Jupyter Notebook %inline。如果有人能解释我错过了什么,那就太好了。我已经尝试了很多很多这些解决方案的变体,但无济于事。

如何更改 seaborn 绘图的图形大小?

如何使 seaborn.heatmap 更大(正常大小)?

如何在 Seaborn 中更改 regplot 的绘图大小?

任何帮助,将不胜感激。感谢您的时间!

标签: pythonmatplotlibseaborn

解决方案


你有没有尝试过:

fig = plt.gcf()
fig.set_size_inches( 16, 10)

推荐阅读