diff --git a/mizani/bounds.py b/mizani/bounds.py index 36e0c57..1e0c29d 100644 --- a/mizani/bounds.py +++ b/mizani/bounds.py @@ -60,11 +60,11 @@ def rescale(x, to=(0, 1), _from=None): -------- >>> x = [0, 2, 4, 6, 8, 10] >>> rescale(x) - array([ 0. , 0.2, 0.4, 0.6, 0.8, 1. ]) + array([0. , 0.2, 0.4, 0.6, 0.8, 1. ]) >>> rescale(x, to=(0, 2)) - array([ 0. , 0.4, 0.8, 1.2, 1.6, 2. ]) + array([0. , 0.4, 0.8, 1.2, 1.6, 2. ]) >>> rescale(x, to=(0, 2), _from=(0, 20)) - array([ 0. , 0.2, 0.4, 0.6, 0.8, 1. ]) + array([0. , 0.2, 0.4, 0.6, 0.8, 1. ]) """ if _from is None: _from = np.min(x), np.max(x) @@ -96,9 +96,9 @@ def rescale_mid(x, to=(0, 1), _from=None, mid=0): Examples -------- >>> rescale_mid([1, 2, 3], mid=1) - array([ 0.5 , 0.75, 1. ]) + array([0.5 , 0.75, 1. ]) >>> rescale_mid([1, 2, 3], mid=2) - array([ 0. , 0.5, 1. ]) + array([0. , 0.5, 1. ]) """ array_like = True @@ -150,21 +150,21 @@ def rescale_max(x, to=(0, 1), _from=None): -------- >>> x = [0, 2, 4, 6, 8, 10] >>> rescale_max(x, (0, 3)) - array([ 0. , 0.6, 1.2, 1.8, 2.4, 3. ]) + array([0. , 0.6, 1.2, 1.8, 2.4, 3. ]) Only the 2nd (max) element of the parameters ``to`` and ``_from`` are essential to the output. >>> rescale_max(x, (1, 3)) - array([ 0. , 0.6, 1.2, 1.8, 2.4, 3. ]) + array([0. , 0.6, 1.2, 1.8, 2.4, 3. ]) >>> rescale_max(x, (0, 20)) - array([ 0., 4., 8., 12., 16., 20.]) + array([ 0., 4., 8., 12., 16., 20.]) If :python:`max(x) < _from[1]` then values will be scaled beyond the requested (:python:`to[1]`) maximum. >>> rescale_max(x, to=(1, 3), _from=(-1, 6)) - array([ 0., 1., 2., 3., 4., 5.]) + array([0., 1., 2., 3., 4., 5.]) """ array_like = True diff --git a/mizani/breaks.py b/mizani/breaks.py index 13f8e5e..d2d2fa8 100644 --- a/mizani/breaks.py +++ b/mizani/breaks.py @@ -64,7 +64,7 @@ class mpl_breaks(object): >>> x = range(10) >>> limits = (0, 9) >>> mpl_breaks()(limits) - array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) + array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) >>> mpl_breaks(nbins=2)(limits) array([ 0., 5., 10.]) """ @@ -170,7 +170,7 @@ class minor_breaks(object): >>> major = [1, 2, 3, 4] >>> limits = [0, 5] >>> minor_breaks()(major, limits) - array([ 0.5, 1.5, 2.5, 3.5, 4.5]) + array([0.5, 1.5, 2.5, 3.5, 4.5]) """ def __init__(self, n=1): self.n = n @@ -248,12 +248,12 @@ class trans_minor_breaks(object): >>> major = [1, 2, 3, 4] >>> limits = [0, 5] >>> sqrt_trans().minor_breaks(major, limits) - array([ 0.5, 1.5, 2.5, 3.5, 4.5]) + array([0.5, 1.5, 2.5, 3.5, 4.5]) >>> class sqrt_trans2(sqrt_trans): ... def __init__(self): ... self.minor_breaks = trans_minor_breaks(sqrt_trans2) >>> sqrt_trans2().minor_breaks(major, limits) - array([ 1.58113883, 2.54950976, 3.53553391]) + array([1.58113883, 2.54950976, 3.53553391]) """ def __init__(self, trans, n=1): self.trans = trans diff --git a/mizani/palettes.py b/mizani/palettes.py index 7f18dd8..4399a89 100644 --- a/mizani/palettes.py +++ b/mizani/palettes.py @@ -145,14 +145,14 @@ def rescale_pal(range=(0.1, 1)): -------- >>> palette = rescale_pal() >>> palette([0, .2, .4, .6, .8, 1]) - array([ 0.1 , 0.28, 0.46, 0.64, 0.82, 1. ]) + array([0.1 , 0.28, 0.46, 0.64, 0.82, 1. ]) The returned palette expects inputs in the ``[0, 1]`` range. Any value outside those limits is clipped to ``range[0]`` or ``range[1]``. >>> palette([-2, -1, 0.2, .4, .8, 2, 3]) - array([ 0.1 , 0.1 , 0.28, 0.46, 0.82, 1. , 1. ]) + array([0.1 , 0.1 , 0.28, 0.46, 0.82, 1. , 1. ]) """ def _rescale(x): return rescale(x, range, _from=(0, 1)) @@ -181,7 +181,7 @@ def area_pal(range=(1, 6)): >>> x = np.arange(0, .6, .1)**2 >>> palette = area_pal() >>> palette(x) - array([ 1. , 1.5, 2. , 2.5, 3. , 3.5]) + array([1. , 1.5, 2. , 2.5, 3. , 3.5]) The results are equidistant because the input ``x`` is in area space, i.e it is squared. @@ -212,7 +212,7 @@ def abs_area(max): >>> x = np.arange(0, .8, .1)**2 >>> palette = abs_area(5) >>> palette(x) - array([ 0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5]) + array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5]) Compared to :func:`area_pal`, :func:`abs_area` will handle values in the range ``[-1, 0]`` without returning ``np.nan``. And values diff --git a/mizani/transforms.py b/mizani/transforms.py index 200e611..e9f904a 100644 --- a/mizani/transforms.py +++ b/mizani/transforms.py @@ -70,13 +70,13 @@ class trans(object): >>> major = [0, 1, 2] >>> t = trans() >>> t.minor_breaks(major) - array([ 0.5, 1.5]) + array([0.5, 1.5]) Create a trans that returns 4 minor breaks >>> t = trans(minor_breaks=minor_breaks(4)) >>> t.minor_breaks(major) - array([ 0.2, 0.4, 0.6, 0.8, 1.2, 1.4, 1.6, 1.8]) + array([0.2, 0.4, 0.6, 0.8, 1.2, 1.4, 1.6, 1.8]) """ #: Aesthetic that the transform works on aesthetic = None