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

Skip to content

Commit c341c87

Browse files
authored
Merge pull request #15993 from anntzer/axd
Style fixes for axes_divider.
2 parents 330e4b2 + adb2efe commit c341c87

1 file changed

Lines changed: 17 additions & 30 deletions

File tree

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
221221
ox = self._calc_offsets(hsizes, k)
222222
oy = self._calc_offsets(vsizes, k)
223223

224-
ww = (ox[-1] - ox[0])/figW
225-
hh = (oy[-1] - oy[0])/figH
224+
ww = (ox[-1] - ox[0]) / figW
225+
hh = (oy[-1] - oy[0]) / figH
226226
pb = mtransforms.Bbox.from_bounds(x, y, w, h)
227227
pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
228228
pb1_anchored = pb1.anchored(self.get_anchor(), pb)
@@ -234,12 +234,12 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
234234
x0, y0 = x, y
235235

236236
if nx1 is None:
237-
nx1 = nx+1
237+
nx1 = nx + 1
238238
if ny1 is None:
239-
ny1 = ny+1
239+
ny1 = ny + 1
240240

241-
x1, w1 = x0 + ox[nx]/figW, (ox[nx1] - ox[nx])/figW
242-
y1, h1 = y0 + oy[ny]/figH, (oy[ny1] - oy[ny])/figH
241+
x1, w1 = x0 + ox[nx] / figW, (ox[nx1] - ox[nx]) / figW
242+
y1, h1 = y0 + oy[ny] / figH, (oy[ny1] - oy[ny]) / figH
243243

244244
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
245245

@@ -313,9 +313,9 @@ def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
313313
self._nx, self._ny = nx - _xrefindex, ny - _yrefindex
314314

315315
if nx1 is None:
316-
nx1 = nx+1
316+
nx1 = nx + 1
317317
if ny1 is None:
318-
ny1 = ny+1
318+
ny1 = ny + 1
319319

320320
self._nx1 = nx1 - _xrefindex
321321
self._ny1 = ny1 - _yrefindex
@@ -380,7 +380,7 @@ def update_params(self):
380380
def get_geometry(self):
381381
"""Get the subplot geometry, e.g., (2, 2, 3)."""
382382
rows, cols, num1, num2 = self.get_subplotspec().get_geometry()
383-
return rows, cols, num1+1 # for compatibility
383+
return rows, cols, num1 + 1 # for compatibility
384384

385385
# COVERAGE NOTE: Never used internally or from examples
386386
def change_geometry(self, numrows, numcols, num):
@@ -642,33 +642,20 @@ def new_locator(self, nx, nx1=None):
642642
def _locate(self, x, y, w, h,
643643
y_equivalent_sizes, x_appended_sizes,
644644
figW, figH):
645-
"""
646-
Parameters
647-
----------
648-
x
649-
y
650-
w
651-
h
652-
y_equivalent_sizes
653-
x_appended_sizes
654-
figW
655-
figH
656-
"""
657-
658645
equivalent_sizes = y_equivalent_sizes
659646
appended_sizes = x_appended_sizes
660647

661-
max_equivalent_size = figH*h
662-
total_appended_size = figW*w
648+
max_equivalent_size = figH * h
649+
total_appended_size = figW * w
663650
karray = self._determine_karray(equivalent_sizes, appended_sizes,
664651
max_equivalent_size,
665652
total_appended_size)
666653

667654
ox = self._calc_offsets(appended_sizes, karray)
668655

669-
ww = (ox[-1] - ox[0])/figW
656+
ww = (ox[-1] - ox[0]) / figW
670657
ref_h = equivalent_sizes[0]
671-
hh = (karray[0]*ref_h[0] + ref_h[1])/figH
658+
hh = (karray[0]*ref_h[0] + ref_h[1]) / figH
672659
pb = mtransforms.Bbox.from_bounds(x, y, w, h)
673660
pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
674661
pb1_anchored = pb1.anchored(self.get_anchor(), pb)
@@ -701,9 +688,9 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
701688
y_equivalent_sizes, x_appended_sizes,
702689
figW, figH)
703690
if nx1 is None:
704-
nx1 = nx+1
691+
nx1 = nx + 1
705692

706-
x1, w1 = x0 + ox[nx]/figW, (ox[nx1] - ox[nx])/figW
693+
x1, w1 = x0 + ox[nx] / figW, (ox[nx1] - ox[nx]) / figW
707694
y1, h1 = y0, hh
708695

709696
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
@@ -755,10 +742,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
755742
x_equivalent_sizes, y_appended_sizes,
756743
figH, figW)
757744
if ny1 is None:
758-
ny1 = ny+1
745+
ny1 = ny + 1
759746

760747
x1, w1 = x0, ww
761-
y1, h1 = y0 + oy[ny]/figH, (oy[ny1] - oy[ny])/figH
748+
y1, h1 = y0 + oy[ny] / figH, (oy[ny1] - oy[ny]) / figH
762749

763750
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
764751

0 commit comments

Comments
 (0)