-1

I'm training on seaborn and i really don't find a way to use .set(xticklabels=()) with rotation parameter inside.

I have looked for every way but i don't find if it is possible.

My code looks like :

fig, ax = plt.subplots()

(alibaba.melt(id_vars=['Date', 'nom'], value_vars=['Open', 'Close'], var_name='Cours', value_name='Valeur')
    .sort_values("Date")
    .reset_index(drop=True)
    .query(" Date > '2020-01' & Date < '2020-03' ")
    .pipe(sns.lineplot, x='Date', y='Valeur', style="Cours", hue="Cours", ax=ax)
    .set(xticklabels=(ax.get_xticklabels(), ?))
    )
sns.despine()

I want to set the xticks rotation to 90 (or whatever) and only use .set() My problem is that it doesn't seem possible to use .set(....).set_xticklabels(....) in method chaining.

So when i try .set(xticklabels=(ax.get_xticklabels()), it works. But if i add the rotation parameter like .set(xticklabels=(ax.get_xticklabels(), rotation=45) it gives me an error.

Thanks for helping me :)

Hedredo

So when i try .set(xticklabels=(ax.get_xticklabels()), it works. But if i add the rotation parameter like .set(xticklabels=(ax.get_xticklabels(), rotation=45) it gives me an error.

Hedredo
  • 1
  • 1

1 Answers1

0

you can use, here my code:

sns.boxplot(data=df, x="made", y="price").tick_params(axis='x', rotation=80)