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

Skip to content

Commit fcee2f7

Browse files
authored
Merge pull request #26042 from anntzer/ag
Further simplify AxesGrid._init_locators.
2 parents 5f25d20 + 35cebb3 commit fcee2f7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,14 @@ def __init__(self, fig,
157157
self.set_label_mode(label_mode)
158158

159159
def _init_locators(self):
160-
h = [Size.Scaled(1), self._horiz_pad_size] * (self._ncols-1) + [Size.Scaled(1)]
161-
h_indices = range(0, 2 * self._ncols, 2) # Indices of Scaled(1).
162-
v = [Size.Scaled(1), self._vert_pad_size] * (self._nrows-1) + [Size.Scaled(1)]
163-
v_indices = range(0, 2 * self._nrows, 2) # Indices of Scaled(1).
160+
self._divider.set_horizontal(
161+
[Size.Scaled(1), self._horiz_pad_size] * (self._ncols-1) + [Size.Scaled(1)])
162+
self._divider.set_vertical(
163+
[Size.Scaled(1), self._vert_pad_size] * (self._nrows-1) + [Size.Scaled(1)])
164164
for i in range(self.ngrids):
165165
col, row = self._get_col_row(i)
166-
locator = self._divider.new_locator(
167-
nx=h_indices[col], ny=v_indices[self._nrows - 1 - row])
168-
self.axes_all[i].set_axes_locator(locator)
169-
self._divider.set_horizontal(h)
170-
self._divider.set_vertical(v)
166+
self.axes_all[i].set_axes_locator(
167+
self._divider.new_locator(nx=2 * col, ny=2 * (self._nrows - 1 - row)))
171168

172169
def _get_col_row(self, n):
173170
if self._direction == "column":

0 commit comments

Comments
 (0)