{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Markov Transition Field\n\n\nThis example shows how to transform a time series into a Markov\nTransition Field using :class:`pyts.image.MarkovTransitionField`.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nfrom pyts.image import MarkovTransitionField\nfrom pyts.datasets import load_gunpoint\n\nX, _, _, _ = load_gunpoint(return_X_y=True)\n\n# MTF transformation\nmtf = MarkovTransitionField(image_size=24)\nX_mtf = mtf.fit_transform(X)\n\n# Show the image for the first time series\nplt.figure(figsize=(6, 6))\nplt.imshow(X_mtf[0], cmap='rainbow', origin='lower')\nplt.title('Markov Transition Field', fontsize=18)\nplt.colorbar(fraction=0.0457, pad=0.04)\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}