diff options
author | Pauli Virtanen <pav@iki.fi> | 2008-10-27 23:40:52 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2008-10-27 23:40:52 +0000 |
commit | 7a70f54f515bb8c586c3967d62731a49217eef95 (patch) | |
tree | 1b3cf9f9a890f04a90e68f65bf85d2c75b309fbb /numpy/lib/function_base.py | |
parent | 78733509e3a1f61c454fb23bae857e6a56a225de (diff) | |
download | numpy-7a70f54f515bb8c586c3967d62731a49217eef95.tar.gz |
Import documentation from doc wiki (part 1)
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 5ca797864..19037d975 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1128,6 +1128,17 @@ def interp(x, xp, fp, left=None, right=None): >>> np.interp(3.14, xp, fp, right=UNDEF) -99.0 + Plot an interpolant to the sine function: + + >>> x = np.linspace(0, 2*np.pi, 10) + >>> y = np.sin(x) + >>> xvals = np.linspace(0, 2*np.pi, 50) + >>> yinterp = np.interp(xvals, x, y) + >>> import matplotlib.pyplot as plt + >>> plt.plot(x, y, 'o') + >>> plt.plot(xvals, yinterp, '-x') + >>> plt.show() + """ if isinstance(x, (float, int, number)): return compiled_interp([x], xp, fp, left, right).item() |