'Matplotlib/Seaborn - How to add whitespace when moving legend outside the figure?
As a follow up to this question How to put the legend outside the plot in Matplotlib, I'm trying to put my legend outside my Seaborn plot. My simplified code is:
sns.lineplot(data=df,
x='x',
y='y',
hue='z',
palette=some dictionary)
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.tight_layout()
However, the legend takes over the majority of the figure!
How can I instruct seaborn/matplotlib to not shrink the main figure but instead add as much whitespace as necessary?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

