I have a dictionary of data that looks like this:
dict_df
dict_df.keys()
# dict_keys(['Facebook', 'Amazon', 'Google', 'Apple'])
dict_df.values()
dict_values([group
below 10 9.50
above 10 3.49
above 20 1.37
above 40 3.78
Name: mix, dtype: float64, group
below 10 9.62
above 10 3.83
above 20 1.51
above 40 3.78
Name: mix, dtype: float64, group
below 10 9.62
above 10 3.83
above 20 1.51
above 40 3.78
Name: mix, dtype: float64, group
below 10 9.62
above 10 3.83
above 20 1.51
above 40 3.78
I draw multiple graphs like so:
for i,plot in enumerate(dict_df.keys()):
plt.figure(i)
ax = sns.barplot(y = 'group', x = 'mix',
data = dict_df[plot].reset_index(),
orient = 'h').set_title(plot)
plt.savefig(rf'Folder\{plot}')
Which draws a bar chart for every key in my dict_df
, now I want to add labels to the end of the vertical bars, I read many solutions but none of them seem to work.
I tried adding this inside my for loop that draws the graphs:
for i in range(len(dict_df[plot])):
plt.annotate(str(dict_df[plot].keys()[i]), xy=(dict_df[plot].keys()[i],
dict_df[plot].values()[i]), ha='center', va='bottom')
Which I found on this answer
But I get TypeError: 'numpy.ndarray' object is not callable
error.