Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5a4324

Browse files
authored
Merge pull request #17511 from jklymak/fix-offset-legend-tightbbox
Fix offset legend tightbbox
2 parents a6f31e3 + b71691a commit a5a4324

File tree

6 files changed

+266
-207
lines changed

6 files changed

+266
-207
lines changed

lib/matplotlib/figure.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,10 @@ def legend(self, *args, **kwargs):
17531753
# kwargs['loc'] = extra_args[0]
17541754
# extra_args = extra_args[1:]
17551755
pass
1756-
l = mlegend.Legend(self, handles, labels, *extra_args, **kwargs)
1756+
transform = kwargs.pop('bbox_transform', self.transFigure)
1757+
# explicitly set the bbox transform if the user hasn't.
1758+
l = mlegend.Legend(self, handles, labels, *extra_args,
1759+
bbox_transform=transform, **kwargs)
17571760
self.legends.append(l)
17581761
l._remove_method = self.legends.remove
17591762
self.stale = True
Binary file not shown.

0 commit comments

Comments
 (0)