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

Skip to content

Commit e511c48

Browse files
committed
Replace axes_size.Fraction by multiplication.
axes_size defines `__rmul__` exactly for this purpose, and `*` seems clearer to read.
1 parent f9084c1 commit e511c48

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,12 @@ def _update_locators(self):
497497
if (self._colorbar_mode == "single" and
498498
self._colorbar_location in ('left', 'bottom')):
499499
if self._colorbar_location == "left":
500-
sz = Size.Fraction(self._nrows, Size.AxesX(self.axes_llc))
500+
sz = self._nrows * Size.AxesX(self.axes_llc)
501501
h.append(Size.from_any(self._colorbar_size, sz))
502502
h.append(Size.from_any(self._colorbar_pad, sz))
503503
locator = self._divider.new_locator(nx=0, ny=0, ny1=-1)
504504
elif self._colorbar_location == "bottom":
505-
sz = Size.Fraction(self._ncols, Size.AxesY(self.axes_llc))
505+
sz = self._ncols * Size.AxesY(self.axes_llc)
506506
v.append(Size.from_any(self._colorbar_size, sz))
507507
v.append(Size.from_any(self._colorbar_pad, sz))
508508
locator = self._divider.new_locator(nx=0, nx1=-1, ny=0)
@@ -602,12 +602,12 @@ def _update_locators(self):
602602

603603
if self._colorbar_mode == "single":
604604
if self._colorbar_location == "right":
605-
sz = Size.Fraction(self._nrows, Size.AxesX(self.axes_llc))
605+
sz = self._nrows * Size.AxesX(self.axes_llc)
606606
h.append(Size.from_any(self._colorbar_pad, sz))
607607
h.append(Size.from_any(self._colorbar_size, sz))
608608
locator = self._divider.new_locator(nx=-2, ny=0, ny1=-1)
609609
elif self._colorbar_location == "top":
610-
sz = Size.Fraction(self._ncols, Size.AxesY(self.axes_llc))
610+
sz = self._ncols * Size.AxesY(self.axes_llc)
611611
v.append(Size.from_any(self._colorbar_pad, sz))
612612
v.append(Size.from_any(self._colorbar_size, sz))
613613
locator = self._divider.new_locator(nx=0, nx1=-1, ny=-2)

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True):
1414

1515
divider = make_axes_locatable(ax)
1616

17-
pad_size = Size.Fraction(pad, Size.AxesY(ax))
17+
pad_size = pad * Size.AxesY(ax)
1818

19-
xsize = Size.Fraction((1.-2.*pad)/3., Size.AxesX(ax))
20-
ysize = Size.Fraction((1.-2.*pad)/3., Size.AxesY(ax))
19+
xsize = ((1-2*pad)/3) * Size.AxesX(ax)
20+
ysize = ((1-2*pad)/3) * Size.AxesY(ax)
2121

2222
divider.set_horizontal([Size.AxesX(ax), pad_size, xsize])
2323
divider.set_vertical([ysize, pad_size, ysize, pad_size, ysize])
@@ -125,10 +125,10 @@ def __init__(self, *args, pad=0, add_all=True, **kwargs):
125125

126126
divider = make_axes_locatable(ax)
127127

128-
pad_size = Size.Fraction(pad, Size.AxesY(ax))
128+
pad_size = pad * Size.AxesY(ax)
129129

130-
xsize = Size.Fraction((1.-2.*pad)/3., Size.AxesX(ax))
131-
ysize = Size.Fraction((1.-2.*pad)/3., Size.AxesY(ax))
130+
xsize = ((1-2*pad)/3) * Size.AxesX(ax)
131+
ysize = ((1-2*pad)/3) * Size.AxesY(ax)
132132

133133
divider.set_horizontal([Size.AxesX(ax), pad_size, xsize])
134134
divider.set_vertical([ysize, pad_size, ysize, pad_size, ysize])

0 commit comments

Comments
 (0)