Annotating bars
There is https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar_label.html so that you don't have to roll your own annotate_bars() function anymore.
Boxplots
Instead of
ax.boxplot(...)
ax.set_xticklabels(labels)
use
ax.boxplot(..., tick_labels=labels)
Annotating bars
There is https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar_label.html so that you don't have to roll your own
annotate_bars()function anymore.Boxplots
Instead of
use