.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/image/plot_dataset_mtf.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_mtf.py: ==================================== Data set of Markov transition fields ==================================== A Markov transition field is an image obtained from a time series, representing a field of transition probabilities for a discretized time series. Different strategies can be used to bin time series. It is implemented as :class:`pyts.image.MarkovTransitionField`. In this example, we consider the training samples of the `GunPoint dataset `_, consisting of 50 univariate time series of length 150. The Markov transition field of each time series is independently computed and the 50 Markov transition fields are plotted. .. GENERATED FROM PYTHON SOURCE LINES 17-49 .. image-sg:: /auto_examples/image/images/sphx_glr_plot_dataset_mtf_001.png :alt: Markov transition fields for the 50 time series in the 'GunPoint' dataset :srcset: /auto_examples/image/images/sphx_glr_plot_dataset_mtf_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 MarkovTransitionField from pyts.datasets import load_gunpoint # Load the GunPoint dataset X, _, _, _ = load_gunpoint(return_X_y=True) # Get the recurrence plots for all the time series mtf = MarkovTransitionField(n_bins=8) X_mtf = mtf.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_mtf[i], cmap='rainbow', origin='lower', vmin=0., 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("Markov transition 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 3.994 seconds) .. _sphx_glr_download_auto_examples_image_plot_dataset_mtf.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_mtf.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dataset_mtf.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_