The example below creates a bar plot and adds value labels to each bar.
import matplotlib.pyplot as plt
beers = ['bud lite', 'coors', 'yuengling', 'miller']
drinks = [20, 40, 80, 50]
_, ax = plt.subplots()
ax.bar(beers, drinks)
ax.bar_label(ax.containers[0], label_type='edge')
ax.set_xlabel('Beer')
ax.set_ylabel('Drinks')
plt.show()
Pythonic Programming © 2024
Built by Gavin Wiggins