Skip to content

Commit e159dde

Browse files
committed
Inline _init_axes_pad into Grid.__init__.
It's only called from `__init__`, so inlining it defines more attributes directly in `__init__`. Also avoids having to wonder about the difference between _init_axes_pad and set_axes_pad.
1 parent 3218b11 commit e159dde

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ def __init__(self, fig,
149149

150150
self.ngrids = ngrids
151151

152-
self._init_axes_pad(axes_pad)
152+
self._horiz_pad_size, self._vert_pad_size = map(
153+
Size.Fixed, np.broadcast_to(axes_pad, 2))
153154

154155
cbook._check_in_list(["column", "row"], direction=direction)
155156
self._direction = direction
@@ -192,11 +193,6 @@ def __init__(self, fig,
192193

193194
self.set_label_mode(label_mode)
194195

195-
def _init_axes_pad(self, axes_pad):
196-
axes_pad = np.broadcast_to(axes_pad, 2)
197-
self._horiz_pad_size = Size.Fixed(axes_pad[0])
198-
self._vert_pad_size = Size.Fixed(axes_pad[1])
199-
200196
def _init_locators(self):
201197

202198
h = []
@@ -256,8 +252,6 @@ def set_axes_pad(self, axes_pad):
256252
axes_pad : (float, float)
257253
The padding (horizontal pad, vertical pad) in inches.
258254
"""
259-
# Differs from _init_axes_pad by 1) not broacasting, 2) modifying the
260-
# Size.Fixed objects in-place.
261255
self._horiz_pad_size.fixed_size = axes_pad[0]
262256
self._vert_pad_size.fixed_size = axes_pad[1]
263257

0 commit comments

Comments
 (0)