{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Eventplot demo\n\nAn `~.axes.Axes.eventplot` showing sequences of events with various line\nproperties. The plot is shown in both horizontal and vertical orientations.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nimport matplotlib\n\nmatplotlib.rcParams['font.size'] = 8.0\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\n\n# create random data\ndata1 = np.random.random([6, 50])\n\n# set different colors for each set of positions\ncolors1 = [f'C{i}' for i in range(6)]\n\n# set different line properties for each set of positions\n# note that some overlap\nlineoffsets1 = [-15, -3, 1, 1.5, 6, 10]\nlinelengths1 = [5, 2, 1, 1, 3, 1.5]\n\nfig, axs = plt.subplots(2, 2)\n\n# create a horizontal plot\naxs[0, 0].eventplot(data1, colors=colors1, lineoffsets=lineoffsets1,\n                    linelengths=linelengths1)\n\n# create a vertical plot\naxs[1, 0].eventplot(data1, colors=colors1, lineoffsets=lineoffsets1,\n                    linelengths=linelengths1, orientation='vertical')\n\n# create another set of random data.\n# the gamma distribution is only used for aesthetic purposes\ndata2 = np.random.gamma(4, size=[60, 50])\n\n# use individual values for the parameters this time\n# these values will be used for all data sets (except lineoffsets2, which\n# sets the increment between each data set in this usage)\ncolors2 = 'black'\nlineoffsets2 = 1\nlinelengths2 = 1\n\n# create a horizontal plot\naxs[0, 1].eventplot(data2, colors=colors2, lineoffsets=lineoffsets2,\n                    linelengths=linelengths2)\n\n\n# create a vertical plot\naxs[1, 1].eventplot(data2, colors=colors2, lineoffsets=lineoffsets2,\n                    linelengths=linelengths2, orientation='vertical')\n\nplt.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        ".. tags::\n\n   plot-type: eventplot\n   level: beginner\n   purpose: showcase\n\n"
      ]
    }
  ],
  "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.14.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}