I am trying to use py.sorted() func to sort the x-axis ("size") in reverse order, despite setting "reverse=True", it doesn't impact the plot, the axis is still in normal order. I wonder what I did wrong ... thanks!
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import seaborn.objects as so
tips = sns.load_dataset("tips")
df = pd.DataFrame(data=tips)
unique_xs = sorted(df["size"].unique(), reverse=True)
f, ax = plt.subplots(1, 2, figsize=(12, 2.4))
sns.violinplot(data=df, x="size", y="tip", ax=ax[0])
sns.lineplot(data=df, x=df["size"].map(unique_xs.index), y="tip", ax=ax[0])
for _, spine in ax[0].spines.items():
spine.set_visible(True)
spine.set_linewidth(10)