I use the following code to create a bar plot: import matplotlib.pyplot as plt products = ['mouse','keyboard','antivirus','scanner','pendrive','battery','mobile'] price = [500, 1200, 550, 4500, 3500, 1500, 2500] plt.title('Scene-1') q = plt.bar(products, price) for b in q: val = b.get_height() plt.text(b.get_x() + b.get_width()/2, val, round(val, 2), ha= 'center', va= 'bottom') print(b) print('b.get_x()', '\n', b.get_x()) plt.show() My question is: how are the x-values returned by b.get_x(), such as -0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6, calculated? And how do these values relate to the positions of the bars on the x-axis in the plot? Continue reading...