The question you link to uses a factorplot
. A factorplot returns its own class which has a method called set_xticklabels(rotation)
. This is different from the set_xticklabels
method of the matplotlib Axes
.
In the linked question’s answers there are also other options which you may use
ax = sns.boxplot(x='categories', y='oxygen', hue="target", data=df)
ax.set_xticklabels(ax.get_xticklabels(),rotation=30)
or
ax = sns.boxplot(x='categories', y='oxygen', hue="target", data=df)
plt.setp(ax.get_xticklabels(), rotation=45)