Label a bar plot.
Adds labels to bars in the given BarContainer. You may need to adjust the axis limits to fit the labels.
BarContainer
Container with all the bars and optionally errorbars, likely returned from bar or barh.
A list of label texts, that should be displayed. If not given, the label texts will be the data values formatted with fmt.
An unnamed %-style or {}-style format string for the label or a function to call with the value as the first argument. When fmt is a string and can be interpreted in both formats, %-style takes precedence over {}-style.
Added in version 3.7: Support for {}-style format string and callables.
The label type. Possible values:
Distance of label from the end of the bar, in points.
Any remaining keyword arguments are passed through to Axes.annotate. The alignment parameters ( horizontalalignment / ha, verticalalignment / va) are not supported because the labels are automatically aligned to the bars.
Annotation
A list of Annotation instances for the labels.
matplotlib.axes.Axes.bar_label
© 2012–2023 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar_label.html