.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/image/plot_dataset_gaf.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. 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_dataset_gaf.py: ================================== Data set of Gramian angular fields ================================== A Gramian angular field is an image obtained from a time series, representing some kind of temporal correlation between each pair of values from the time series. Two methods are available: Gramian angular summation field and Gramian angular difference field. It is implemented as :class:`pyts.image.GramianAngularField`. In this example, we consider the training samples of the `GunPoint dataset `_, consisting of 50 univariate time series of length 150. The Gramian angular summation field of each time series is independently computed and the 50 Gramian angular summation fields are plotted. .. GENERATED FROM PYTHON SOURCE LINES 18-50 .. image-sg:: /auto_examples/image/images/sphx_glr_plot_dataset_gaf_001.png :alt: Gramian angular summation fields for the 50 time series in the 'GunPoint' dataset :srcset: /auto_examples/image/images/sphx_glr_plot_dataset_gaf_001.png :class: sphx-glr-single-img .. code-block:: default # Author: Johann Faouzi # License: BSD-3-Clause import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid from pyts.image import GramianAngularField from pyts.datasets import load_gunpoint # Load the GunPoint dataset X, _, _, _ = load_gunpoint(return_X_y=True) # Get the Gramian angular summation fields for all the time series gaf = GramianAngularField() X_gaf = gaf.fit_transform(X) # Plot the 50 Gramian angular fields fig = plt.figure(figsize=(10, 5)) grid = ImageGrid(fig, 111, nrows_ncols=(5, 10), axes_pad=0.1, share_all=True, cbar_mode='single') for i, ax in enumerate(grid): im = ax.imshow(X_gaf[i], cmap='rainbow', origin='lower', vmin=-1., vmax=1.) grid[0].get_yaxis().set_ticks([]) grid[0].get_xaxis().set_ticks([]) plt.colorbar(im, cax=grid.cbar_axes[0]) ax.cax.toggle_label(True) fig.suptitle("Gramian angular summation fields for the 50 time series in the " "'GunPoint' dataset", y=0.92) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 4.552 seconds) .. _sphx_glr_download_auto_examples_image_plot_dataset_gaf.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dataset_gaf.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dataset_gaf.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_