.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_image_plot_rp.py: =============== Recurrence Plot =============== A recurrence plot is an image obtained from a time series, representing the distances between each time point. The image can be binarized using a threshold. It is implemented as :class:`pyts.image.RecurrencePlot`. .. image:: /auto_examples/image/images/sphx_glr_plot_rp_001.png :class: sphx-glr-single-img .. code-block:: default # Author: Johann Faouzi # License: BSD-3-Clause import matplotlib.pyplot as plt from pyts.image import RecurrencePlot from pyts.datasets import load_gunpoint X, _, _, _ = load_gunpoint(return_X_y=True) # Recurrence plot transformation rp = RecurrencePlot(threshold='point', percentage=20) X_rp = rp.fit_transform(X) # Show the results for the first time series plt.figure(figsize=(5, 5)) plt.imshow(X_rp[0], cmap='binary', origin='lower') plt.title('Recurrence Plot', fontsize=16) plt.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.731 seconds) .. _sphx_glr_download_auto_examples_image_plot_rp.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_rp.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_rp.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_