I have the following dataset and I have plotted a Stacked Bar Chart using Matplotlib.
industry Distribution Manufacturing Retail Services
2017-09 1 4 12 7
2017-10 3 2 3 4
2017-11 1 0 2 1
2018-02 1 0 0 0
the following is the code to generate the Graph:
fig, ax = plt.subplots(1, figsize=(17,6))
part1 = ax.bar(industry_split.index.values, 'Retail', data=industry_split, color = 'darkblue', width=0.5, edgecolor=edgecolor, linewidth=linewidth)
part2 = ax.bar(industry_split.index.values, 'Services', data=industry_split, color = 'dodgerblue', edgecolor=edgecolor, linewidth=linewidth, width=0.5, bottom = industry_split.Retail)
part3 = ax.bar(industry_split.index.values, 'Manufacturing', data=industry_split, color = 'green', width=0.5, edgecolor=edgecolor, linewidth=linewidth, bottom = industry_split.Retail + industry_split.Services)
part4 = ax.bar(industry_split.index.values, 'Distribution', data=industry_split, color = 'orange', width=0.5, edgecolor=edgecolor, linewidth=linewidth, bottom = industry_split.Retail + industry_split.Services + industry_split.Manufacturing)
I need to annotate the values in the graph. For instance, I need the value for each bar to appear inside the bar of the graph. See example below