summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-04-17 13:46:36 +0300
committermattip <matti.picus@gmail.com>2018-04-17 16:54:10 +0300
commitdf8e83538461c29bc12c44198574bde8ffefcad7 (patch)
treed16f3b97dfa068fce3f081bdcd6a7c94240bb426 /numpy/lib/function_base.py
parent8323be1bc44c2811fc36f5b99c1a30ebcee8edbd (diff)
downloadnumpy-df8e83538461c29bc12c44198574bde8ffefcad7.tar.gz
DOC: clear up warnings, fix matplotlib plot
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py29
1 files changed, 16 insertions, 13 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(