问题
I have a multilevel data frame, sorted by values on level=1
I want to make a grouped bar plot. When I do
ax = sns.barplot(ax=ax, x="level0", y="values",
hue="level1", data=data)
Sns decides to sort index by level1.
Is there a way to make sns respect the order of rows when making grouped bar plots?
回答1:
As per the comment from @ImportanceOfBeingErnest, you can use the order and hue_order parameters to control in which order the bars appear along the x-axis.
来源:https://stackoverflow.com/questions/45987198/grouped-bar-chart-how-to-make-sns-respect-order-of-rows