8000 FIX: make borderaxespad consistent · matplotlib/matplotlib@ad76514 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad76514

Browse files
committed
FIX: make borderaxespad consistent
1 parent 820943d commit ad76514

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/gridspec.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,10 @@ def legend_outside(self, handles=None, labels=None, axs=None,
187187

188188
if axs is None:
189189
axs = self.figure.get_axes()
190-
padding = kwargs.pop('borderaxespad', 2.0)
190+
padding = kwargs.pop('borderaxespad', rcParams["legend.borderaxespad"])
191191

192192
# convert padding from points to figure relative units....
193-
padding = padding / 72.0
194-
paddingw = padding / self.figure.get_size_inches()[0]
195-
paddingh = padding / self.figure.get_size_inches()[1]
193+
196194

197195
handles, labels, extra_args, kwargs = legend._parse_legend_args(
198196
axs, handles=handles, labels=labels, **kwargs)
@@ -217,6 +215,10 @@ def legend_outside(self, handles=None, labels=None, axs=None,
217215
elif leg._loc in [3, 4]:
218216
stack = 'bottom'
219217

218+
padding = padding * leg._fontsize / 72.0
219+
paddingw = padding / self.figure.get_size_inches()[0]
220+
paddingh = padding / self.figure.get_size_inches()[1]
221+
220222
for child in self._layoutbox.children:
221223
if child._is_subplotspec_layoutbox():
222224
if stack == 'right':

0 commit comments

Comments
 (0)
0