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

Skip to content

Commit ed1a18a

Browse files
committed
FIX: make borderaxespad consistent
1 parent 1bd8a85 commit ed1a18a

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
@@ -191,12 +191,10 @@ def legend_outside(self, handles=None, labels=None, axs=None,
191191

192192
if axs is None:
193193
axs = self.figure.get_axes()
194-
padding = kwargs.pop('borderaxespad', 2.0)
194+
padding = kwargs.pop('borderaxespad', rcParams["legend.borderaxespad"])
195195

196196
# convert padding from points to figure relative units....
197-
padding = padding / 72.0
198-
paddingw = padding / self.figure.get_size_inches()[0]
199-
paddingh = padding / self.figure.get_size_inches()[1]
197+
200198

201199
handles, labels, extra_args, kwargs = legend._parse_legend_args(
202200
axs, handles=handles, labels=labels, **kwargs)
@@ -221,6 +219,10 @@ def legend_outside(self, handles=None, labels=None, axs=None,
221219
elif leg._loc in [3, 4]:
222220
stack = 'bottom'
223221

222+
padding = padding * leg._fontsize / 72.0
223+
paddingw = padding / self.figure.get_size_inches()[0]
224+
paddingh = padding / self.figure.get_size_inches()[1]
225+
224226
for child in self._layoutbox.children:
225227
if child._is_subplotspec_layoutbox():
226228
if stack == 'right':

0 commit comments

Comments
 (0)