import matplotlib.pyplot as plt labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] product_A = [20, 35, 30, 35, 27, 43, 24, 34, 14, 27, 22, 50] product_B = [25, 32, 34, 20, 25, 34, 54, 23, 43, 33, 27, 29] width = 0.35 fig, ax = plt.subplots() ax.bar(labels, product_A, width, label='Product A') ax.bar(labels, product_B, width, bottom=product_A, label='Product B') ax.set_ylabel('Scores') ax.set_title('Sales of Product A and Product B') ax.legend() plt.show()