looking for some solutions? You are welcome.

SOLVED: Horizontal plot in swarmplot of seaborn

s_narisawa:

Situation
I have the following pandas dataset:

|user_id|total|is_fat|
|-------|-----|------|
|1      |100  |1     |
|2      |150  |0     |
|3      |400  |1     |
|4      |500  |1     |
|5      |10   |0     |

where elements of the total are integer and elements of is_fat are string.

I denote above dataset by df.

Then run

import seaborn as sos
sns.swarmplot(x = 'total', y ='is_fat', data = df)

Now the graph I expected is like enter image description here

Problem However, the output graph is the following:

enter image description here

Why?

Search
If I convert '1' to 'fat' and '0' to 'not_fat', then I get the expected graph.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent