def plot_employee_count_comparison(df, cmap1, cmap2): _, (ax1, ax2) = plt.subplots(1, 2, figsize=(18, 7), sharex=True, sharey=True) df.plot(kind="barh", colormap=cmap1, width=0.8, edgecolor="#000000", stacked=True, ax=ax1) for container in ax1.containers: ax1.bar_label(container, label_type="center", fontsize=10, color="#FFFFFF", fontweight="bold") ax1.set_title("Employee Count (Discrete Colormap)", loc="left", fontdict={"weight": "bold"}, y=1.06) ax1.set_xlabel("Count") ax1.set_ylabel("Department") df.plot(kind="barh", colormap=cmap2, width=0.8, edgecolor="#000000", stacked=True, ax=ax2) for container in ax2.containers: ax2.bar_label(container, label_type="center", fontsize=10, color="#FFFFFF", fontweight="bold") ax2.set_title("Employee Count (Linear Colormap)", loc="left", fontdict={"weight": "bold"}, y=1.06) ax2.set_xlabel("Count") ax2.set_ylabel("Department") # Adjust layout plt.tight_layout() plt.show() plot_employee_count_comparison(df=df, cmap1=cmap_discrete, cmap2=cmap_linear)