diff options
author | mattip <matti.picus@gmail.com> | 2018-04-17 13:46:36 +0300 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2018-04-17 16:54:10 +0300 |
commit | df8e83538461c29bc12c44198574bde8ffefcad7 (patch) | |
tree | d16f3b97dfa068fce3f081bdcd6a7c94240bb426 /numpy/lib | |
parent | 8323be1bc44c2811fc36f5b99c1a30ebcee8edbd (diff) | |
download | numpy-df8e83538461c29bc12c44198574bde8ffefcad7.tar.gz |
DOC: clear up warnings, fix matplotlib plot
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/function_base.py | 29 | ||||
-rw-r--r-- | numpy/lib/mixins.py | 4 | ||||
-rw-r--r-- | numpy/lib/nanfunctions.py | 15 | ||||
-rw-r--r-- | numpy/lib/npyio.py | 15 |
4 files changed, 34 insertions, 29 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8440be52e..0e517ee8f 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3400,17 +3400,19 @@ def percentile(a, q, axis=None, out=None, If True, then allow the input array `a` to be modified by intermediate calculations, to save memory. In this case, the contents of the input `a` after this function completes is undefined. + interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} This optional parameter specifies the interpolation method to use when the desired quantile lies between two data points ``i < j``: - * linear: ``i + (j - i) * fraction``, where ``fraction`` - is the fractional part of the index surrounded by ``i`` - and ``j``. - * lower: ``i``. - * higher: ``j``. - * nearest: ``i`` or ``j``, whichever is nearest. - * midpoint: ``(i + j) / 2``. + + * 'linear': ``i + (j - i) * fraction``, where ``fraction`` + is the fractional part of the index surrounded by ``i`` + and ``j``. + * 'lower': ``i``. + * 'higher': ``j``. + * 'nearest': ``i`` or ``j``, whichever is nearest. + * 'midpoint': ``(i + j) / 2``. .. versionadded:: 1.9.0 keepdims : bool, optional @@ -3479,18 +3481,19 @@ def percentile(a, q, axis=None, out=None, The different types of interpolation can be visualized graphically: - ..plot:: + .. plot:: + import matplotlib.pyplot as plt a = np.arange(4) p = np.linspace(0, 100, 6001) ax = plt.gca() lines = [ - ('linear', None) - ('higher', '--') - ('lower', '--') - ('nearest', '-.') - ('midpoint', '-.') + ('linear', None), + ('higher', '--'), + ('lower', '--'), + ('nearest', '-.'), + ('midpoint', '-.'), ] for interpolation, style in lines: ax.plot( diff --git a/numpy/lib/mixins.py b/numpy/lib/mixins.py index 3220f6534..0379ecb1a 100644 --- a/numpy/lib/mixins.py +++ b/numpy/lib/mixins.py @@ -74,8 +74,8 @@ class NDArrayOperatorsMixin(object): It is useful for writing classes that do not inherit from `numpy.ndarray`, but that should support arithmetic and numpy universal functions like - arrays as described in :ref:`A Mechanism for Overriding Ufuncs - <neps.ufunc-overrides>`. + arrays as described in `A Mechanism for Overriding Ufuncs + <../../neps/nep-0013-ufunc-overrides.html>`_. As an trivial example, consider this implementation of an ``ArrayLike`` class that simply wraps a NumPy array and ensures that the result of any diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py index 16e363d7c..dddc0e5b8 100644 --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -1059,13 +1059,14 @@ def nanpercentile(a, q, axis=None, out=None, overwrite_input=False, This optional parameter specifies the interpolation method to use when the desired quantile lies between two data points ``i < j``: - * linear: ``i + (j - i) * fraction``, where ``fraction`` - is the fractional part of the index surrounded by ``i`` - and ``j``. - * lower: ``i``. - * higher: ``j``. - * nearest: ``i`` or ``j``, whichever is nearest. - * midpoint: ``(i + j) / 2``. + + * 'linear': ``i + (j - i) * fraction``, where ``fraction`` + is the fractional part of the index surrounded by ``i`` + and ``j``. + * 'lower': ``i``. + * 'higher': ``j``. + * 'nearest': ``i`` or ``j``, whichever is nearest. + * 'midpoint': ``(i + j) / 2``. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 29688f73d..59379bdda 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1166,13 +1166,14 @@ def savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', multi-format string, e.g. 'Iteration %d -- %10.5f', in which case `delimiter` is ignored. For complex `X`, the legal options for `fmt` are: - a) a single specifier, `fmt='%.4e'`, resulting in numbers formatted - like `' (%s+%sj)' % (fmt, fmt)` - b) a full string specifying every real and imaginary part, e.g. - `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns - c) a list of specifiers, one per column - in this case, the real - and imaginary part must have separate specifiers, - e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns + + * a single specifier, `fmt='%.4e'`, resulting in numbers formatted + like `' (%s+%sj)' % (fmt, fmt)` + * a full string specifying every real and imaginary part, e.g. + `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns + * a list of specifiers, one per column - in this case, the real + and imaginary part must have separate specifiers, + e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns delimiter : str, optional String or character separating columns. newline : str, optional |