I have a seaborn barplot with a line graphed on top of it that looks like this:
As you can see, there are thick margins on the plot that appear after adding the line. The plot looks normal if the line is not added:
plt.margins()
does not work and basically destroys the entire graph. Not sure why. I have not tried additional rc-settings in sns.set()
because I cannot find the page that lists all the options anymore, so if someone could link that as well so I could bookmark it that would be appreciated.
The barplot is created with:
sns.set(rc={'figure.figsize': (50, 10), 'axes.labelsize': 25, 'ytick.labelsize': 17, 'axes.labelpad': 15, 'legend.fontsize': 20})
fig, ax1 = plt.subplots()
g = sns.barplot(x='City/Town', y="Value", hue="Metric", data=df, ax=ax1)
g.set_title(title, fontsize=30)
fig.autofmt_xdate()
and the line is added with:
ax1.plot(range(len(X)), df.Y_pred[df['Metric'] == bar1]*scale, color='red')
where X and Y are numpy ndArrays and scale is just an int.