'Changing axis label size in Seaborn catplot [duplicate]
I am trying to enlarge the x-axis labels (that is 'onshore', 'offshore', and 'solar'), along with rotating them. But whenever I increase the size, the column sizes of my cat subplots decrease and compress the image. Is there a way to increase the font size of axis labels without decreasing/compressing the subplots in the seaborn catplot?
Here is my code:
#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()
Solution 1:[1]
For those facing the same issue - I found a fix, play around with the 'height' and 'aspect' parameters of the catplot in Seaborn. The width of each facet or each subplot is equal to height*aspect. This stackoverflow post was helpful.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pandi20 |