【发布时间】:2021-07-20 03:00:03
【问题描述】:
我正在尝试放大 x 轴标签(即“陆上”、“离岸”和“太阳能”),同时旋转它们。但是每当我增加大小时,我的 cat 子图的列大小就会减小并压缩图像。有没有办法在不减少/压缩 seaborn catplot 中的子图的情况下增加轴标签的字体大小?
这是我的代码:
#plt.subplots(figsize=(28,12))
sns.set_theme(style = "whitegrid", font_scale= 1.9)
ax = sns.catplot(x="generator", y="ELCC", hue="Nameplate Capacity",
col="Scenario", aspect=.7,
kind="box",palette = 'RdYlBu', data=final_df)
plt.legend(bbox_to_anchor = (1, 1))
ax.set_xticklabels(rotation = 30)
ax.set_xlabels('Generator Type', fontsize=20) # not set_label
ax.set_ylabels('ELCC', fontsize= 20)
ax.fig.set_size_inches(45,22)
plt.show()
【问题讨论】:
-
sns.set_theme(style = "whitegrid", font_scale= 1.9)如果我不需要这条线会怎样?为什么没有启用字体调整大小? -
该行用于放大子图字体大小,例如图上方的文本以及'solar'、'onshore、'offshore'
标签: matplotlib seaborn axis-labels facet-grid catplot