Hello I'm trying to create a combo chart containing a clustered bar chart and a multi-line chart but something seems to be out of place. tried adjusting the thickness of the bars as well but it didn't work. Thank you, appreciate your help!
#Create combo chart
fig, ax1 = plt.subplots(figsize=(18.5, 10.5))
color = 'tab:green'
#Create bar plot
ax1.set_title('Overview', fontsize=16)
ax1.set_xlabel('Year', fontsize=16)
ax1.set_ylabel('Values', fontsize=16, color=color)
ax1 = sns.barplot(x='Year', y='Values', hue='Legend', data=data.head(24), palette='flare')
plt.ylabel("Bystander CPR, AED (%); Mean EMS response time (mins)")
ax1.tick_params(axis='y')
#Specify the sharing of x-axis
ax2 = ax1.twinx()
color = 'tab:red'
#Create line plot
ax2.set_ylabel('Values', fontsize=16, color=color)
ax2 = sns.lineplot(x='Year', y='Values', hue='Legend', data=data.tail(16), sort=False, palette='summer', linestyle='--')
plt.ylabel("No. of survivors % Utstein survival (%)")
ax2.tick_params(axis='y', color=color)
#Change bar width
def change_width(ax, new_value) :
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - new_value
# we change the bar width
patch.set_width(new_value)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
change_width(ax, .35)
#Show plot
plt.show()