Issue
I have this plot that you'll agree is not very pretty. Other plots I made so far had some color and grouping to them out of the box.
I tried manually setting the color, but it stays black. What am I doing wrong? Ideally it'd also cluster the same tags together.
df.groupby(['tags_0', 'gender']).count().plot(kind='barh', legend=False, color=['r', 'g', 'b'])
Solution
You need to unstack your results:
df.groupby(['tags_0', 'gender']).gender.count().unstack().plot(kind='barh', legend=False, color=['r', 'g', 'b'])
I don't have your data, so just used a value of one for each tag/gender combo.
Answered By - Alexander
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.