def plot_bar(legend_pos: tuple = (1.25, 1)): x = np.array(["New York", "San Francisco", "Los Angeles", "Chicago", "Miami"]) y1 = np.array([50, 63, 40, 68, 35]) y2 = np.array([77, 85, 62, 89, 58]) y3 = np.array([50, 35, 79, 43, 67]) y4 = np.array([59, 62, 33, 77, 72]) plt.bar(x, y1, label="HR") plt.bar(x, y2, bottom=y1, label="Engineering") plt.bar(x, y3, bottom=y1 + y2, label="Marketing") plt.bar(x, y4, bottom=y1 + y2 + y3, label="Sales") plt.title("Employee Count Per Location And Department", y=1.06) plt.xlabel("Office Location") plt.ylabel("Count") plt.legend(bbox_to_anchor=legend_pos) plt.show()