.. note::
    :class: sphx-glr-download-link-note

    Click :ref:`here <sphx_glr_download_gallery_lines_bars_and_markers_interp_demo.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_lines_bars_and_markers_interp_demo.py:


===========
Interp Demo
===========





.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_interp_demo_001.png
    :class: sphx-glr-single-img





.. code-block:: python

    import matplotlib.pyplot as plt
    import numpy as np

    x = np.linspace(0, 2 * np.pi, 20)
    y = np.sin(x)
    yp = None
    xi = np.linspace(x[0], x[-1], 100)
    yi = np.interp(xi, x, y, yp)

    fig, ax = plt.subplots()
    ax.plot(x, y, 'o', xi, yi, '.')
    plt.show()


.. _sphx_glr_download_gallery_lines_bars_and_markers_interp_demo.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download

     :download:`Download Python source code: interp_demo.py <interp_demo.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: interp_demo.ipynb <interp_demo.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
