I'm not able to rotate my xlabels in Seaborn/Matplotlib. I have tried many different solutions but not able to fix it. I have seen many related questions here on stackoverflow, but they have not worked for me.
My current plot looks like this, but I want the xlabels to rotate 90.
@staticmethod
def plotPrestasjon(plot):
sns.set(style="darkgrid")
ax = sns.catplot(x="COURSE", y="FINISH", hue="COURSE",
col="BIB#", data=plot, s=9, palette="Set2")
ax.set(xlabel='COURSES', ylabel='FINISH (sec)')
plt.show()
I have tried:
ax.set_xticklabels(ax.get_xticklabels(), rotation=90)
But that fails to generate the plot. Any ideas how I can fix it?

sns.catplot, according to the documentation, is with the.set_xticklabelsmethod (.e.g.g.set_xticklabels(rotation=30)).Axes, should be used if changes need to be made on a plot by plot basis, within theFacetGrid.seaborn.FacetGridg, or in the case of the OP,axis aseaborn.axisgrid.FacetGridax.axes.flat,axesis a<class 'matplotlib.axes._subplots.AxesSubplot'>, which has a wide array of class methods, including.get_xticklabels().col_wrap=is used,g.set_xticklabels(rotation=30)may result in removing all the xticklabels.labels=must be specified,g.set_xticklabels(g.axes.flat[-1].get_xticklabels(), rotation=30), whereg.axes.flat[-1]should be the last facet axes with xticklabels.g.tick_params(axis='x', rotation=30)python 3.12,matplotlib 3.8.1,seaborn 0.13.0One Row & Multiple Columns
Multiple Rows & Columns
g.set_xticklabels(g.get_xticklabels(), rotation=30)results in anAttributeError.