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

Skip to content

Commit adb2efe

Browse files
committed
Style fixes for axes_divider.
Plain style fixes, and getting rid of a docstring which adds no information.
1 parent e70c9d2 commit adb2efe

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):
@@ -646,33 +646,20 @@ def new_locator(self, nx, nx1=None):
646646
def _locate(self, x, y, w, h,
647647
y_equivalent_sizes, x_appended_sizes,
648648
figW, figH):
649-
"""
650-
Parameters
651-
----------
652-
x
653-
y
654-
w
655-
h
656-
y_equivalent_sizes
657-
x_appended_sizes
658-
figW
659-
figH
660-
"""
661-
662649
equivalent_sizes = y_equivalent_sizes
663650
appended_sizes = x_appended_sizes
664651

665-
max_equivalent_size = figH*h
666-
total_appended_size = figW*w
652+
max_equivalent_size = figH * h
653+
total_appended_size = figW * w
667654
karray = self._determine_karray(equivalent_sizes, appended_sizes,
668655
max_equivalent_size,
669656
total_appended_size)
670657

671658
ox = self._calc_offsets(appended_sizes, karray)
672659

673-
ww = (ox[-1] - ox[0])/figW
660+
ww = (ox[-1] - ox[0]) / figW
674661
ref_h = equivalent_sizes[0]
675-
hh = (karray[0]*ref_h[0] + ref_h[1])/figH
662+
hh = (karray[0]*ref_h[0] + ref_h[1]) / figH
676663
pb = mtransforms.Bbox.from_bounds(x, y, w, h)
677664
pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
678665
pb1_anchored = pb1.anchored(self.get_anchor(), pb)
@@ -705,9 +692,9 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
705692
y_equivalent_sizes, x_appended_sizes,
706693
figW, figH)
707694
if nx1 is None:
708-
nx1 = nx+1
695+
nx1 = nx + 1
709696

710-
x1, w1 = x0 + ox[nx]/figW, (ox[nx1] - ox[nx])/figW
697+
x1, w1 = x0 + ox[nx] / figW, (ox[nx1] - ox[nx]) / figW
711698
y1, h1 = y0, hh
712699

713700
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
@@ -759,10 +746,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
759746
x_equivalent_sizes, y_appended_sizes,
760747
figH, figW)
761748
if ny1 is None:
762-
ny1 = ny+1
749+
ny1 = ny + 1
763750

764751
x1, w1 = x0, ww
765-
y1, h1 = y0 + oy[ny]/figH, (oy[ny1] - oy[ny])/figH
752+
y1, h1 = y0 + oy[ny] / figH, (oy[ny1] - oy[ny]) / figH
766753

767754
return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
768755

0 commit comments

Comments
 (0)