I have been trying to use pointplot in Seaborn and in general it does what I need and I'm very impressed with the functionality.
My use case is fairly standard:
sns.pointplot(x="Category_1", y="Parameter", hue="Category 2", data=df);
My issue is that the Category I use for the hue contains strings in the form:
"1 string1", "2 string2", "3 string3", etc....
This is by design so that I can get a particular order if I sort. However when I run the Seaborn function the order is different.
By what logic does Seaborn order this, and is there a way for forcing a desired order. If I do:
A = df.Category2.unique()
A.sort()
I get the list order that I want.
Ben
As explained in the tutorial , categorical plotting functions follow a set of rules to determine the order of plot elements:
order
parameter, that order is used. Categorical
with an assigned category order, that order is used.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.