I have an sns.pairplot, with the legend outside the axes. No matter how I adjust the bbox_to_anchor, unless I put the right side of the legend inside the axes, the legend would have its left side cut off a bit.
This is how the legend positioned originally:
I can successfully adjust the position of the legend by:
g._legend.set_bbox_to_anchor((1, .53, .0, 0))
And no matter how I move the legend, it is always the same little part of the legend being cutoff. This is really weird. Is this due to some call by:
plt.subplots_adjust(hspace=0.02, wspace=0.04)
Here are all the commands that I called to adjust the legend:
g._legend.set_title('')
g._legend.set_bbox_to_anchor((1.01, .53, 0, 0))
#new_labels = ['Cluster 1', 'Cluster 2', 'Cluster 3'...]
new_labels = ['Cluster ' + str(i) for i in range(1, len(cluster_data[cluster_col_index].unique()+1))]
for t, l in zip(g._legend.texts, new_labels): t.set_text(l)
for lh in g._legend.legendHandles:
lh.set_alpha(1)
lh._sizes = [70]
And
g._legend.borderpad=5
also does not work...