import matplotlib.pyplot as plt # Assuming you have a list of categories and their values categories = ['Category1', 'Category2', 'Category3'] values = [20, 35, 30] plt.bar(categories, values) # Loop to add values on each bar for i in range(len(values)): plt.text(x = i, y = values[i]+0.5, s = values[i], ha = 'center') plt.show()