Reputation: 93
I'm working with the Movielens dataset
and I want to plot the preference of the two genders towards the different movie genres. Following code results into a stacked bar graph, where I want to have it as a grouped (meaning two columns for each movie genre one for the female users and second one for the male users).
columns = ['Action', 'Adventure' , 'Animation' ,'Childrens' , 'Comedy']
plt.figure(figsize=(18,10))
plt.bar(columns, all_female_users.iloc[:, 6:10].sum()/total_female_users)
plt.bar(columns, all_male_users.iloc[:, 6:10].sum()/total_male_users)
plt.show()
Desired output with two bars over each tick (one female, one male
Upvotes: 0
Views: 496
Reputation: 173
Hi I believe you are using a stacked barplot and that is why it isn't working, I think you should refer to the documentation here, just to use the grouped bar chart with labels. Link: https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/barchart.html#sphx-glr-gallery-lines-bars-and-markers-barchart-py
Hope this helps!
Upvotes: 1