I am trying to improve my visualizations on Python. Assume I have this data:
data = {'animal':['cat', 'tiger', 'leopard', 'dog'], 'family':['mustelids ','felidae','felidae', 'canidae'], 'family_pct':[6.06,33.33,9.09,12.12]}
df = pd.DataFrame(data)
I want to create a barplot as follows:
fig, ax = plt.subplots()
sns.barplot(x = 'family', y = 'family_pct', hue='animal', data = df)
However, I would like each "family" to be plotted separately (one plot for mustelids, one for felidae, and one for canidae) and not on the same plot. I effectively would like to loop the graph over every value of the family column. However, I am not sure how to go about this.
Thanks!