import numpy as np import matplotlib.pyplot as plt # Data categories = ['A', 'B', 'C', 'D', 'E'] values1 = [10, 15, 7, 12, 9] values2 = [5, 8, 3, 6, 4] # Create stacked bar plot plt.bar(categories, values1, label='Value 1') plt.bar(categories, values2, bottom=values1, label='Value 2') plt.xlabel('Categories') plt.ylabel('Values') plt.title('Stacked Bar Plot') plt.legend() plt.show()