From 7a70f54f515bb8c586c3967d62731a49217eef95 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Mon, 27 Oct 2008 23:40:52 +0000 Subject: Import documentation from doc wiki (part 1) --- numpy/lib/function_base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'numpy/lib/function_base.py') 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() -- cgit v1.2.1