{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Matplotlib\n",
    "    Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002.\n",
    "\n",
    "    One of the greatest benefits of visualization is that it allows us visual access to huge amounts of data in easily digestible visuals. Matplotlib consists of several plots like line, bar, scatter, histogram etc.\n",
    "    \n",
    "    \n",
    "        from matplotlib import pyplot as plt\n",
    "        or\n",
    "        import matplotlib.pyplot as plt "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13432 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "# x axis coordinates\n",
    "x = [4,2,3,5 ,10]\n",
    "# y axis coordinates\n",
    "y = [4,5,7,3,2]\n",
    "# plot a normal graph \n",
    "plt.plot(x , y )\n",
    "# to show the graph\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5004 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# to plot the bar\n",
    "plt.bar(x, y,color='g')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5608 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plot to show histogram\n",
    "plt.hist(y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5580 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# to plot the scatter\n",
    "plt.scatter(x,y, color='pink')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25504 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import random\n",
    "import matplotlib.pyplot as plt\n",
    "fig = plt.figure()\n",
    "\n",
    "# function to get random values for x and y axis\n",
    "def get_coordinates():\n",
    "    xx = []\n",
    "    yy = []\n",
    "    for i in range(10):\n",
    "        xx.append(i)\n",
    "        yy.append(random.randrange(10))\n",
    "    return xx , yy\n",
    "\n",
    "# defining the subplots\n",
    "a = fig.add_subplot(221)\n",
    "b = fig.add_subplot(222)\n",
    "c = fig.add_subplot(223)\n",
    "d = fig.add_subplot(224)\n",
    "\n",
    "# hiding marker on axis\n",
    "x , y = get_coordinates()\n",
    "a.plot(x, y)\n",
    "a.tick_params(which = \"both\", axis = \"both\" , length = 0)\n",
    "# can also change the marker length by setting , legth = any float value\n",
    "\n",
    "# hiding the tick and marker\n",
    "b.plot(x, y)\n",
    "b.axes.get_xaxis().set_visible(False)\n",
    "b.axes.get_yaxis().set_visible(False)\n",
    "\n",
    "# hiding the values and displaying the marker\n",
    "c.plot(x, y)\n",
    "c.xaxis.set_major_formatter(plt.NullFormatter())\n",
    "c.yaxis.set_major_formatter(plt.NullFormatter())\n",
    "\n",
    "# tilt the ticks\n",
    "d.plot(x, y)\n",
    "d.tick_params(axis = 'x' , rotation = 45)\n",
    "d.tick_params(axis = 'y', rotation = 90)\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23048 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "x = [12,3,35 ,63, 64, 33 ,46, 77,3]\n",
    "y = [3 , 35 , 32 ,5 , 6 , 6  , 45 ,54,24]\n",
    "\n",
    "plt.plot(x, y )\n",
    "plt.xlabel('example x')\n",
    "plt.ylabel('example y')\n",
    "xvalues = ['rahul', 'Tarun', 'Nidhi', 'Gurdayal', 'kajal','Sonia','Dheeraj','Pawan', 'Tushar','Kishan']\n",
    "#plt.xticks(np.arange(0,85,5))\n",
    "#plt.xticks([])\n",
    "plt.yticks(np.arange(0,70 ,4))\n",
    "#plt.yticks([])\n",
    "plt.xticks(np.arange(13),xvalues, rotation = 90)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function linspace in module numpy:\n",
      "\n",
      "linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)\n",
      "    Return evenly spaced numbers over a specified interval.\n",
      "    \n",
      "    Returns `num` evenly spaced samples, calculated over the\n",
      "    interval [`start`, `stop`].\n",
      "    \n",
      "    The endpoint of the interval can optionally be excluded.\n",
      "    \n",
      "    .. versionchanged:: 1.16.0\n",
      "        Non-scalar `start` and `stop` are now supported.\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    start : array_like\n",
      "        The starting value of the sequence.\n",
      "    stop : array_like\n",
      "        The end value of the sequence, unless `endpoint` is set to False.\n",
      "        In that case, the sequence consists of all but the last of ``num + 1``\n",
      "        evenly spaced samples, so that `stop` is excluded.  Note that the step\n",
      "        size changes when `endpoint` is False.\n",
      "    num : int, optional\n",
      "        Number of samples to generate. Default is 50. Must be non-negative.\n",
      "    endpoint : bool, optional\n",
      "        If True, `stop` is the last sample. Otherwise, it is not included.\n",
      "        Default is True.\n",
      "    retstep : bool, optional\n",
      "        If True, return (`samples`, `step`), where `step` is the spacing\n",
      "        between samples.\n",
      "    dtype : dtype, optional\n",
      "        The type of the output array.  If `dtype` is not given, infer the data\n",
      "        type from the other input arguments.\n",
      "    \n",
      "        .. versionadded:: 1.9.0\n",
      "    \n",
      "    axis : int, optional\n",
      "        The axis in the result to store the samples.  Relevant only if start\n",
      "        or stop are array-like.  By default (0), the samples will be along a\n",
      "        new axis inserted at the beginning. Use -1 to get an axis at the end.\n",
      "    \n",
      "        .. versionadded:: 1.16.0\n",
      "    \n",
      "    Returns\n",
      "    -------\n",
      "    samples : ndarray\n",
      "        There are `num` equally spaced samples in the closed interval\n",
      "        ``[start, stop]`` or the half-open interval ``[start, stop)``\n",
      "        (depending on whether `endpoint` is True or False).\n",
      "    step : float, optional\n",
      "        Only returned if `retstep` is True\n",
      "    \n",
      "        Size of spacing between samples.\n",
      "    \n",
      "    \n",
      "    See Also\n",
      "    --------\n",
      "    arange : Similar to `linspace`, but uses a step size (instead of the\n",
      "             number of samples).\n",
      "    geomspace : Similar to `linspace`, but with numbers spaced evenly on a log\n",
      "                scale (a geometric progression).\n",
      "    logspace : Similar to `geomspace`, but with the end points specified as\n",
      "               logarithms.\n",
      "    \n",
      "    Examples\n",
      "    --------\n",
      "    >>> np.linspace(2.0, 3.0, num=5)\n",
      "    array([2.  , 2.25, 2.5 , 2.75, 3.  ])\n",
      "    >>> np.linspace(2.0, 3.0, num=5, endpoint=False)\n",
      "    array([2. ,  2.2,  2.4,  2.6,  2.8])\n",
      "    >>> np.linspace(2.0, 3.0, num=5, retstep=True)\n",
      "    (array([2.  ,  2.25,  2.5 ,  2.75,  3.  ]), 0.25)\n",
      "    \n",
      "    Graphical illustration:\n",
      "    \n",
      "    >>> import matplotlib.pyplot as plt\n",
      "    >>> N = 8\n",
      "    >>> y = np.zeros(N)\n",
      "    >>> x1 = np.linspace(0, 10, N, endpoint=True)\n",
      "    >>> x2 = np.linspace(0, 10, N, endpoint=False)\n",
      "    >>> plt.plot(x1, y, 'o')\n",
      "    [<matplotlib.lines.Line2D object at 0x...>]\n",
      "    >>> plt.plot(x2, y + 0.5, 'o')\n",
      "    [<matplotlib.lines.Line2D object at 0x...>]\n",
      "    >>> plt.ylim([-0.5, 1])\n",
      "    (-0.5, 1)\n",
      "    >>> plt.show()\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(np.linspace)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 6100 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Example on how to use linspace\n",
    "N = 8\n",
    "y = np.zeros(N)\n",
    "x1 = np.linspace(0,10 , N , endpoint = True)\n",
    "x2 = np.linspace(0,10 , N , endpoint = False)\n",
    "\n",
    "plt.plot(x1,y, 'o')\n",
    "plt.plot(x2,y+0.5,'o')\n",
    "\n",
    "plt.ylim([-0.5,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 22044 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0,2,100)\n",
    "plt.plot(x,x,label ='Linear')\n",
    "plt.plot(x,x**2, label = 'Quadratic')\n",
    "plt.plot(x,x**3,label = 'Cubic')\n",
    "\n",
    "plt.xlabel('X axis')\n",
    "plt.ylabel('Y axis')\n",
    "plt.title(\"Example plot\")\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18940 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# to plot the sin wave\n",
    "x = np.arange(0,10, 0.2)\n",
    "y = np.sin(x)\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "ax.plot(x, y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13328 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(0,10, 0.2)\n",
    "y = np.tan(x)\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "ax.plot(x, y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fd1a8e76400>]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 59304 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def myfunc(ax , data1 , data2 , kwargs):\n",
    "    out = ax.plot(data1 , data2 , **kwargs)\n",
    "    return out\n",
    "\n",
    "data1 , data2 = np.random.randn(2, 100)\n",
    "fig , (ax,ax2,ax3) = plt.subplots(1, 3)\n",
    "myfunc(ax, data1 ,data2 , {'marker': 'o'})\n",
    "myfunc(ax2, data1 ,data2 , {'marker': 'x'})\n",
    "myfunc(ax3, data1 ,data2 , {'marker': 'o'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/rahul/my_project_dir/my_project_env/lib/python3.6/site-packages/ipykernel_launcher.py:13: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.\n",
      "  del sys.path[0]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0.5, 1.0, 'Easy as 1, 2, 3')"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 16144 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 14024 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "plt.figure(1)                # the first figure\n",
    "plt.subplot(211)             # the first subplot in the first figure\n",
    "plt.plot([1, 2, 3])\n",
    "plt.subplot(212)             # the second subplot in the first figure\n",
    "plt.plot([4, 5, 6])\n",
    "\n",
    "\n",
    "plt.figure(2)                # a second figure\n",
    "plt.plot([4, 5, 6])          # creates a subplot(111) by default\n",
    "\n",
    "plt.figure(1)                # figure 1 current; subplot(212) still current\n",
    "plt.subplot(211)             # make subplot(211) in figure1 current\n",
    "plt.title('Easy as 1, 2, 3') # subplot 211 title\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function subplot in module matplotlib.pyplot:\n",
      "\n",
      "subplot(*args, **kwargs)\n",
      "    Add a subplot to the current figure.\n",
      "    \n",
      "    Wrapper of `.Figure.add_subplot` with a difference in behavior\n",
      "    explained in the notes section.\n",
      "    \n",
      "    Call signatures::\n",
      "    \n",
      "       subplot(nrows, ncols, index, **kwargs)\n",
      "       subplot(pos, **kwargs)\n",
      "       subplot(ax)\n",
      "    \n",
      "    Parameters\n",
      "    ----------\n",
      "    *args\n",
      "        Either a 3-digit integer or three separate integers\n",
      "        describing the position of the subplot. If the three\n",
      "        integers are *nrows*, *ncols*, and *index* in order, the\n",
      "        subplot will take the *index* position on a grid with *nrows*\n",
      "        rows and *ncols* columns. *index* starts at 1 in the upper left\n",
      "        corner and increases to the right.\n",
      "    \n",
      "        *pos* is a three digit integer, where the first digit is the\n",
      "        number of rows, the second the number of columns, and the third\n",
      "        the index of the subplot. i.e. fig.add_subplot(235) is the same as\n",
      "        fig.add_subplot(2, 3, 5). Note that all integers must be less than\n",
      "        10 for this form to work.\n",
      "    \n",
      "    projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optional\n",
      "        The projection type of the subplot (`~.axes.Axes`). *str* is the name\n",
      "        of a custom projection, see `~matplotlib.projections`. The default\n",
      "        None results in a 'rectilinear' projection.\n",
      "    \n",
      "    polar : boolean, optional\n",
      "        If True, equivalent to projection='polar'.\n",
      "    \n",
      "    sharex, sharey : `~.axes.Axes`, optional\n",
      "        Share the x or y `~matplotlib.axis` with sharex and/or sharey. The\n",
      "        axis will have the same limits, ticks, and scale as the axis of the\n",
      "        shared axes.\n",
      "    \n",
      "    label : str\n",
      "        A label for the returned axes.\n",
      "    \n",
      "    Other Parameters\n",
      "    ----------------\n",
      "    **kwargs\n",
      "        This method also takes the keyword arguments for\n",
      "        the returned axes base class. The keyword arguments for the\n",
      "        rectilinear base class `~.axes.Axes` can be found in\n",
      "        the following table but there might also be other keyword\n",
      "        arguments if another projection is used.\n",
      "          adjustable: {'box', 'datalim'}\n",
      "      agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n",
      "      alpha: float\n",
      "      anchor: 2-tuple of floats or {'C', 'SW', 'S', 'SE', ...}\n",
      "      animated: bool\n",
      "      aspect: {'auto', 'equal'} or num\n",
      "      autoscale_on: bool\n",
      "      autoscalex_on: bool\n",
      "      autoscaley_on: bool\n",
      "      axes_locator: Callable[[Axes, Renderer], Bbox]\n",
      "      axisbelow: bool or 'line'\n",
      "      clip_box: `.Bbox`\n",
      "      clip_on: bool\n",
      "      clip_path: [(`~matplotlib.path.Path`, `.Transform`) | `.Patch` | None]\n",
      "      contains: callable\n",
      "      facecolor: color\n",
      "      fc: color\n",
      "      figure: `.Figure`\n",
      "      frame_on: bool\n",
      "      gid: str\n",
      "      in_layout: bool\n",
      "      label: object\n",
      "      navigate: bool\n",
      "      navigate_mode: unknown\n",
      "      path_effects: `.AbstractPathEffect`\n",
      "      picker: None or bool or float or callable\n",
      "      position: [left, bottom, width, height] or `~matplotlib.transforms.Bbox`\n",
      "      rasterization_zorder: float or None\n",
      "      rasterized: bool or None\n",
      "      sketch_params: (scale: float, length: float, randomness: float)\n",
      "      snap: bool or None\n",
      "      title: str\n",
      "      transform: `.Transform`\n",
      "      url: str\n",
      "      visible: bool\n",
      "      xbound: unknown\n",
      "      xlabel: str\n",
      "      xlim: (left: float, right: float)\n",
      "      xmargin: float greater than -0.5\n",
      "      xscale: {\"linear\", \"log\", \"symlog\", \"logit\", ...}\n",
      "      xticklabels: List[str]\n",
      "      xticks: list\n",
      "      ybound: unknown\n",
      "      ylabel: str\n",
      "      ylim: (bottom: float, top: float)\n",
      "      ymargin: float greater than -0.5\n",
      "      yscale: {\"linear\", \"log\", \"symlog\", \"logit\", ...}\n",
      "      yticklabels: List[str]\n",
      "      yticks: list\n",
      "      zorder: float\n",
      "    \n",
      "    Returns\n",
      "    -------\n",
      "    axes : an `.axes.SubplotBase` subclass of `~.axes.Axes` (or a subclass     of `~.axes.Axes`)\n",
      "    \n",
      "        The axes of the subplot. The returned axes base class depends on\n",
      "        the projection used. It is `~.axes.Axes` if rectilinear projection\n",
      "        are used and `.projections.polar.PolarAxes` if polar projection\n",
      "        are used. The returned axes is then a subplot subclass of the\n",
      "        base class.\n",
      "    \n",
      "    Notes\n",
      "    -----\n",
      "    Creating a subplot will delete any pre-existing subplot that overlaps\n",
      "    with it beyond sharing a boundary::\n",
      "    \n",
      "        import matplotlib.pyplot as plt\n",
      "        # plot a line, implicitly creating a subplot(111)\n",
      "        plt.plot([1,2,3])\n",
      "        # now create a subplot which represents the top plot of a grid\n",
      "        # with 2 rows and 1 column. Since this subplot will overlap the\n",
      "        # first, the plot (and its axes) previously created, will be removed\n",
      "        plt.subplot(211)\n",
      "    \n",
      "    If you do not want this behavior, use the `.Figure.add_subplot` method\n",
      "    or the `.pyplot.axes` function instead.\n",
      "    \n",
      "    If the figure already has a subplot with key (*args*,\n",
      "    *kwargs*) then it will simply make that subplot current and\n",
      "    return it.  This behavior is deprecated. Meanwhile, if you do\n",
      "    not want this behavior (i.e., you want to force the creation of a\n",
      "    new subplot), you must use a unique set of args and kwargs.  The axes\n",
      "    *label* attribute has been exposed for this purpose: if you want\n",
      "    two subplots that are otherwise identical to be added to the figure,\n",
      "    make sure you give them unique labels.\n",
      "    \n",
      "    In rare circumstances, `.add_subplot` may be called with a single\n",
      "    argument, a subplot axes instance already created in the\n",
      "    present figure but not in the figure's list of axes.\n",
      "    \n",
      "    See Also\n",
      "    --------\n",
      "    .Figure.add_subplot\n",
      "    .pyplot.subplots\n",
      "    .pyplot.axes\n",
      "    .Figure.subplots\n",
      "    \n",
      "    Examples\n",
      "    --------\n",
      "    ::\n",
      "    \n",
      "        plt.subplot(221)\n",
      "    \n",
      "        # equivalent but more general\n",
      "        ax1=plt.subplot(2, 2, 1)\n",
      "    \n",
      "        # add a subplot with no frame\n",
      "        ax2=plt.subplot(222, frameon=False)\n",
      "    \n",
      "        # add a polar subplot\n",
      "        plt.subplot(223, projection='polar')\n",
      "    \n",
      "        # add a red subplot that shares the x-axis with ax1\n",
      "        plt.subplot(224, sharex=ax1, facecolor='red')\n",
      "    \n",
      "        # delete ax2 from the figure\n",
      "        plt.delaxes(ax2)\n",
      "    \n",
      "        # add ax2 to the figure again\n",
      "        plt.subplot(ax2)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(plt.subplot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# tutorial on pyplot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'plt' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-1-21a83f625e21>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[0;31m# plt.plot([1,2,3,4],[1,2,3,4],'go-',linewidth = 2, markersize = 12)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      8\u001b[0m \u001b[0;31m# plt.plot([1,2,3,4],[1,2,3,4],'go--',linewidth = 2, markersize = 12)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcolor\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'green'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mmarker\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'+'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlinestyle\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'dashed'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlinewidth\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmarkersize\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m12\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     10\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'plt' is not defined"
     ]
    }
   ],
   "source": [
    "# plt.plot([1,2,3,4],[1,2,3,4],'ro')\n",
    "# plt.axis([1,10, 1,10])\n",
    "# plt.show()\n",
    "\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'go')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'r+')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'go-',linewidth = 2, markersize = 12)\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'go--',linewidth = 2, markersize = 12)\n",
    "plt.plot([1,2,3,4],[1,2,3,4],color = 'green',marker = '+',linestyle = 'dashed',linewidth = 2, markersize = 12)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Plotting multiple sets of data\n",
    "\n",
    "There are various ways to plot multiple sets of data.\n",
    "\n",
    "The most straight forward way is just to call plot multiple times. Example:\n",
    "\n",
    ">>> plot(x1, y1, 'bo')\n",
    ">>> plot(x2, y2, 'go')\n",
    "Copy to clipboard\n",
    "Alternatively, if your data is already a 2d array, you can pass it directly to x, y. A separate data set will be drawn for every column.\n",
    "\n",
    "Example: an array a where the first column represents the x values and the other columns are the y columns:\n",
    "\n",
    ">>> plot(a[0], a[1:])\n",
    "Copy to clipboard\n",
    "The third way is to specify multiple sets of [x], y, [fmt] groups:\n",
    "\n",
    ">>> plot(x1, y1, 'g^', x2, y2, 'g-')\n",
    "Copy to clipboard\n",
    "In this case, any additional keyword argument applies to all datasets. Also this syntax cannot be combined with the data parameter.\n",
    "\n",
    "By default, each line is assigned a different style specified by a 'style cycle'. The fmt and line property parameters are only necessary if you want explicit deviations from these defaults. Alternatively, you can also change the style cycle using the 'axes.prop_cycle' rcParam."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 4808 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# plt.plot([1,2,3,4],[1,2,3,4],'g.', [7,8,9,10],[7,8,9,10],'r,',[5,3,2,1],[2,3,4,5],'yo')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'gv', [7,8,9,10],[7,8,9,10],'r^',[5,3,2,1],[2,3,4,5],'y>')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'g<', [7,8,9,10],[7,8,9,10],'r1',[5,3,2,1],[2,3,4,5],'y2')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'g3', [7,8,9,10],[7,8,9,10],'r4',[5,3,2,1],[2,3,4,5],'ys')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'gp', [7,8,9,10],[7,8,9,10],'r*',[5,3,2,1],[2,3,4,5],'yh')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'gH', [7,8,9,10],[7,8,9,10],'rx',[5,3,2,1],[2,3,4,5],'y+')\n",
    "# plt.plot([1,2,3,4],[1,2,3,4],'gd', [7,8,9,10],[7,8,9,10],'rD',[5,3,2,1],[2,3,4,5],'y_')\n",
    "plt.plot([1,2,3,4],[1,2,3,4],'mo', [7,8,9,10],[7,8,9,10],'kD',[5,3,2,1],[2,3,4,5],'cs')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Markers\n",
    "\n",
    "character\tdescription\n",
    "'.'\tpoint marker\n",
    "','\tpixel marker\n",
    "'o'\tcircle marker\n",
    "'v'\ttriangle_down marker\n",
    "'^'\ttriangle_up marker\n",
    "'<'\ttriangle_left marker\n",
    "'>'\ttriangle_right marker\n",
    "'1'\ttri_down marker\n",
    "'2'\ttri_up marker\n",
    "'3'\ttri_left marker\n",
    "'4'\ttri_right marker\n",
    "'s'\tsquare marker\n",
    "'p'\tpentagon marker\n",
    "'*'\tstar marker\n",
    "'h'\thexagon1 marker\n",
    "'H'\thexagon2 marker\n",
    "'+'\tplus marker\n",
    "'x'\tx marker\n",
    "'D'\tdiamond marker\n",
    "'d'\tthin_diamond marker\n",
    "'|'\tvline marker\n",
    "'_'\thline marker\n",
    "\n",
    "# Line Styles\n",
    "\n",
    "character\tdescription\n",
    "'-'\tsolid line style\n",
    "'--'\tdashed line style\n",
    "'-.'\tdash-dot line style\n",
    "':'\tdotted line style\n",
    "\n",
    "# Color\n",
    "character\tcolor\n",
    "'b'\tblue\n",
    "'g'\tgreen\n",
    "'r'\tred\n",
    "'c'\tcyan\n",
    "'m'\tmagenta\n",
    "'y'\tyellow\n",
    "'k'\tblack\n",
    "'w'\twhite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 124008 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure()\n",
    "plt.axis([0, 10, 0, 10])\n",
    "t = (\"This is a really long string that I'd rather have wrapped so that it \"\n",
    "     \"doesn't go outside of the figure, but if it's long enough it will go \"\n",
    "     \"off the top or bottom!\")\n",
    "plt.text(4, 1, t, ha='left', rotation=15, wrap=True,color='b')\n",
    "plt.text(6, 5, t, ha='left', rotation=15, wrap=True,color = 'g')\n",
    "plt.text(5, 5, t, ha='right', rotation=-15, wrap=True,color = 'r')\n",
    "plt.text(5, 10, t, fontsize=18, style='oblique', ha='center',\n",
    "         va='top', wrap=True,color= 'y')\n",
    "plt.text(3, 4, t, family='serif', style='italic', ha='right', wrap=True,color='m')\n",
    "plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True,color ='k')\n",
    "\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23164 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data = {'a': np.arange(50),\n",
    "        'c': np.random.randint(0, 50, 50),\n",
    "        'd': np.random.randn(50)}\n",
    "data['b'] = data['a'] + 10 * np.random.randn(50)\n",
    "data['d'] = np.abs(data['d']) * 100\n",
    "\n",
    "plt.scatter('a', 'b', c='c', s='d', data=data)\n",
    "plt.xlabel('entry a')\n",
    "plt.ylabel('entry b')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 14088 characters]\n",
      "text/plain": [
       "<Figure size 864x360 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "names = ['group_a','group_b','group_c']\n",
    "values = [1,20,100]\n",
    "\n",
    "plt.figure(figsize=(12,5))\n",
    "plt.subplot(131)\n",
    "plt.bar(names , values)\n",
    "plt.subplot(132)\n",
    "plt.scatter(names , values)\n",
    "plt.subplot(133)\n",
    "plt.plot(names , values)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 9600 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lines = plt.plot([1,2,3],[4,5,6], [4,5,6],[1,2,3])\n",
    "# use keyword args\n",
    "plt.setp(lines, color='m', linewidth=2.0)\n",
    "# plt.xticks([])\n",
    "# plt.yticks([1,2,3])\n",
    "# plt.yticks([8,9,10])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 40992 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def f(t):\n",
    "    return np.exp(-t) * np.cos(2*np.pi*t)\n",
    "\n",
    "t1 = np.arange(0.0, 5.0, 0.1)\n",
    "t2 = np.arange(0.0, 5.0, 0.02)\n",
    "\n",
    "plt.figure()\n",
    "\n",
    "plt.subplot(221)\n",
    "plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')\n",
    "\n",
    "plt.subplot(222)\n",
    "plt.plot(t2, np.cos(2*np.pi*t2), 'r--')\n",
    "\n",
    "plt.subplot(223)\n",
    "plt.plot(t2, np.tan(2*np.pi*t2), 'm--')\n",
    "\n",
    "plt.subplot(224)\n",
    "plt.plot(t2, np.cos(2*np.pi*t2), 'y--')\n",
    "\n",
    "plt.show()\n",
    "# plt.clf()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12160 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# wroking with histogram and text\n",
    "mu , sigma = 100,15\n",
    "x = mu + sigma * np.random.randn(10000)\n",
    "\n",
    "n , bins, patches = plt.hist(x , 50,alpha = 0.75 , density = 1, facecolor ='r')\n",
    "plt.xlabel('Smarts', family = 'serif',color = 'b')\n",
    "plt.ylabel('Probability',family = 'sans-serif',color = 'c')\n",
    "plt.title('Histogram of IQ', family = 'monospace',color='g')\n",
    "plt.text(60,0.025 ,'$ \\mu = 100, \\sigma = 5$' , fontsize = 12,color='b',backgroundcolor = 'w')\n",
    "plt.axis([40,160,0,0.03])\n",
    "plt.grid()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5216 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# mathametical expressions\n",
    "# plt.title(r'$\\alpha > \\beta$')\n",
    "# plt.title(r'$\\sum_{i=0}^\\infty x_i$' )\n",
    "# plt.text(0.4,0.4,r'$\\frac{3}{4} \\binom{3}{4} \\genfrac{}{}{0}{}{3}{4}$',fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$\\frac{5 - \\frac{1}{x}}{4}$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$(\\frac{5 - \\frac{1}{x}}{4})$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$\\left(\\frac{5 - \\frac{1}{x}}{4}\\right)$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$\\sqrt{8}$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$\\sqrt[13]{8}$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$s(t) = \\mathcal{A}sin(2\\omega t)$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$s(t) = \\mathfrak{A}sin(2\\omega t)$', fontsize = 18)\n",
    "# plt.text(0.4 , 0.4,r'$\\vec {abc} , \\overline{abc} , \\widehat{abc}$', fontsize = 18)\n",
    "plt.text(0.4,0.4 , r\"$\\hat i\\ \\ \\hat \\imath$\" , fontsize = 18)\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Command\n",
    "    \\mathrm{Roman}\t\n",
    "    \\mathit{Italic}\t\n",
    "    \\mathtt{Typewriter}\t\n",
    "    \\mathcal{CALLIGRAPHY}\t\n",
    "\n",
    "\n",
    "    \\mathbb{blackboard}\t\n",
    "    \\mathrm{\\mathbb{blackboard}}\t\n",
    "    \\mathfrak{Fraktur}\t\n",
    "    \\mathsf{sansserif}\t\n",
    "    \\mathrm{\\mathsf{sansserif}}\t\n",
    "    \n",
    "    \n",
    "    \\acute a or \\'a\t\n",
    "    \\bar a\t\n",
    "    \\breve a\t\n",
    "    \\ddot a or \\''a\t\n",
    "    \\dot a or \\.a\t\n",
    "    \\grave a or \\`a\t\n",
    "    \\hat a or \\^a\t\n",
    "    \\tilde a or \\~a\t\n",
    "    \\vec a\t\n",
    "    \\overline{abc}\t\n",
    "    \n",
    "    \n",
    "    \\widehat{xyz}\t\n",
    "    \\widetilde{xyz}\t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# symbols\n",
    "    \\infty, \\leftarrow, \\sum, \\int α \\alpha\tβ \\beta\tχ \\chi\tδ \\delta\tϝ \\digamma\tε \\epsilon\n",
    "    η \\eta\tγ \\gamma\tι \\iota\tκ \\kappa\tλ \\lambda\tμ \\mu\n",
    "    ν \\nu\tω \\omega\tϕ \\phi\tπ \\pi\tψ \\psi\tρ \\rho\n",
    "    σ \\sigma\tτ \\tau\tθ \\theta\tυ \\upsilon\tε \\varepsilon\tϰ \\varkappa\n",
    "    φ \\varphi\tϖ \\varpi\tϱ \\varrho\tς \\varsigma\tϑ \\vartheta\tξ \\xi\n",
    "    ζ \\zeta \n",
    "    \n",
    "    Δ \\Delta\tΓ \\Gamma\tΛ \\Lambda\tΩ \\Omega\tΦ \\Phi\tΠ \\Pi\tΨ \\Psi\tΣ \\Sigma\n",
    "    Θ \\Theta\tΥ \\Upsilon\tΞ \\Xi\t℧ \\mho\t∇ \\nabla\n",
    "    \n",
    "    ℵ \\aleph\tℶ \\beth\tℸ \\daleth\tℷ \\gimel\t\n",
    "    \n",
    "    / /\t[ [\t⇓ \\Downarrow\t⇑ \\Uparrow\t‖ \\Vert\t\\backslash\n",
    "    ↓ \\downarrow\t⟨ \\langle\t⌈ \\lceil\t⌊ \\lfloor\t⌞ \\llcorner\t⌟ \\lrcorner\n",
    "    ⟩ \\rangle\t⌉ \\rceil\t⌋ \\rfloor\t⌜ \\ulcorner\t↑ \\uparrow\t⌝ \\urcorner\n",
    "    \\vert\n",
    "    { \\{\t\n",
    "    \\|\n",
    "    } \\}\t] ]\t\n",
    "    |\n",
    "    \n",
    "    ⋂ \\bigcap\t⋃ \\bigcup\t⨀ \\bigodot\t⨁ \\bigoplus\t⨂ \\bigotimes\t⨄ \\biguplus\n",
    "    ⋁ \\bigvee\t⋀ \\bigwedge\t∐ \\coprod\t∫ \\int\t∮ \\oint\t∏ \\prod\n",
    "    ∑ \\sum\n",
    "    \n",
    "    Pr \\Pr\tarccos \\arccos\tarcsin \\arcsin\tarctan \\arctan\targ \\arg\tcos \\cos\n",
    "    cosh \\cosh\tcot \\cot\tcoth \\coth\tcsc \\csc\tdeg \\deg\tdet \\det\n",
    "    dim \\dim\texp \\exp\tgcd \\gcd\thom \\hom\tinf \\inf\tker \\ker\n",
    "    lg \\lg\tlim \\lim\tliminf \\liminf\tlimsup \\limsup\tln \\ln\tlog \\log\n",
    "    max \\max\tmin \\min\tsec \\sec\tsin \\sin\tsinh \\sinh\tsup \\sup\n",
    "    tan \\tan\ttanh \\tanh\n",
    "    \n",
    "    \n",
    "    ≎ \\Bumpeq\t⋒ \\Cap\t⋓ \\Cup\t≑ \\Doteq\n",
    "    ⨝ \\Join\t⋐ \\Subset\t⋑ \\Supset\t⊩ \\Vdash\n",
    "    ⊪ \\Vvdash\t≈ \\approx\t≊ \\approxeq\t∗ \\ast\n",
    "    ≍ \\asymp\t϶ \\backepsilon\t∽ \\backsim\t⋍ \\backsimeq\n",
    "    ⊼ \\barwedge\t∵ \\because\t≬ \\between\t○ \\bigcirc\n",
    "    ▽ \\bigtriangledown\t△ \\bigtriangleup\t◀ \\blacktriangleleft\t▶ \\blacktriangleright\n",
    "    ⊥ \\bot\t⋈ \\bowtie\t⊡ \\boxdot\t⊟ \\boxminus\n",
    "    ⊞ \\boxplus\t⊠ \\boxtimes\t∙ \\bullet\t≏ \\bumpeq\n",
    "    ∩ \\cap\t⋅ \\cdot\t∘ \\circ\t≗ \\circeq\n",
    "    ≔ \\coloneq\t≅ \\cong\t∪ \\cup\t⋞ \\curlyeqprec\n",
    "    ⋟ \\curlyeqsucc\t⋎ \\curlyvee\t⋏ \\curlywedge\t† \\dag\n",
    "    ⊣ \\dashv\t‡ \\ddag\t⋄ \\diamond\t÷ \\div\n",
    "    ⋇ \\divideontimes\t≐ \\doteq\t≑ \\doteqdot\t∔ \\dotplus\n",
    "    ⌆ \\doublebarwedge\t≖ \\eqcirc\t≕ \\eqcolon\t≂ \\eqsim\n",
    "    ⪖ \\eqslantgtr\t⪕ \\eqslantless\t≡ \\equiv\t≒ \\fallingdotseq\n",
    "    ⌢ \\frown\t≥ \\geq\t≧ \\geqq\t⩾ \\geqslant\n",
    "    ≫ \\gg\t⋙ \\ggg\t⪺ \\gnapprox\t≩ \\gneqq\n",
    "    ⋧ \\gnsim\t⪆ \\gtrapprox\t⋗ \\gtrdot\t⋛ \\gtreqless\n",
    "    ⪌ \\gtreqqless\t≷ \\gtrless\t≳ \\gtrsim\t∈ \\in\n",
    "    ⊺ \\intercal\t⋋ \\leftthreetimes\t≤ \\leq\t≦ \\leqq\n",
    "    ⩽ \\leqslant\t⪅ \\lessapprox\t⋖ \\lessdot\t⋚ \\lesseqgtr\n",
    "    ⪋ \\lesseqqgtr\t≶ \\lessgtr\t≲ \\lesssim\t≪ \\ll\n",
    "    ⋘ \\lll\t⪹ \\lnapprox\t≨ \\lneqq\t⋦ \\lnsim\n",
    "    ⋉ \\ltimes\t∣ \\mid\t⊧ \\models\t∓ \\mp\n",
    "    ⊯ \\nVDash\t⊮ \\nVdash\t≉ \\napprox\t≇ \\ncong\n",
    "    ≠ \\ne\t≠ \\neq\t≠ \\neq\t≢ \\nequiv\n",
    "    ≱ \\ngeq\t≯ \\ngtr\t∋ \\ni\t≰ \\nleq\n",
    "    ≮ \\nless\t∤ \\nmid\t∉ \\notin\t∦ \\nparallel\n",
    "    ⊀ \\nprec\t≁ \\nsim\t⊄ \\nsubset\t⊈ \\nsubseteq\n",
    "    ⊁ \\nsucc\t⊅ \\nsupset\t⊉ \\nsupseteq\t⋪ \\ntriangleleft\n",
    "    ⋬ \\ntrianglelefteq\t⋫ \\ntriangleright\t⋭ \\ntrianglerighteq\t⊭ \\nvDash\n",
    "    ⊬ \\nvdash\t⊙ \\odot\t⊖ \\ominus\t⊕ \\oplus\n",
    "    ⊘ \\oslash\t⊗ \\otimes\t∥ \\parallel\t⟂ \\perp\n",
    "    ⋔ \\pitchfork\t± \\pm\t≺ \\prec\t⪷ \\precapprox\n",
    "    ≼ \\preccurlyeq\t≼ \\preceq\t⪹ \\precnapprox\t⋨ \\precnsim\n",
    "    ≾ \\precsim\t∝ \\propto\t⋌ \\rightthreetimes\t≓ \\risingdotseq\n",
    "    ⋊ \\rtimes\t∼ \\sim\t≃ \\simeq\t∕ \\slash\n",
    "    ⌣ \\smile\t⊓ \\sqcap\t⊔ \\sqcup\t⊏ \\sqsubset\n",
    "    ⊏ \\sqsubset\t⊑ \\sqsubseteq\t⊐ \\sqsupset\t⊐ \\sqsupset\n",
    "    ⊒ \\sqsupseteq\t⋆ \\star\t⊂ \\subset\t⊆ \\subseteq\n",
    "    ⫅ \\subseteqq\t⊊ \\subsetneq\t⫋ \\subsetneqq\t≻ \\succ\n",
    "    ⪸ \\succapprox\t≽ \\succcurlyeq\t≽ \\succeq\t⪺ \\succnapprox\n",
    "    ⋩ \\succnsim\t≿ \\succsim\t⊃ \\supset\t⊇ \\supseteq\n",
    "    ⫆ \\supseteqq\t⊋ \\supsetneq\t⫌ \\supsetneqq\t∴ \\therefore\n",
    "    × \\times\t⊤ \\top\t◁ \\triangleleft\t⊴ \\trianglelefteq\n",
    "    ≜ \\triangleq\t▷ \\triangleright\t⊵ \\trianglerighteq\t⊎ \\uplus\n",
    "    ⊨ \\vDash\t∝ \\varpropto\t⊲ \\vartriangleleft\t⊳ \\vartriangleright\n",
    "    ⊢ \\vdash\t∨ \\vee\t⊻ \\veebar\t∧ \\wedge\n",
    "    ≀ \\wr\n",
    "    \n",
    "    ⇓ \\Downarrow\t⇐ \\Leftarrow\t⇔ \\Leftrightarrow\t⇚ \\Lleftarrow\n",
    "    ⟸ \\Longleftarrow\t⟺ \\Longleftrightarrow\t⟹ \\Longrightarrow\t↰ \\Lsh\n",
    "    ⇗ \\Nearrow\t⇖ \\Nwarrow\t⇒ \\Rightarrow\t⇛ \\Rrightarrow\n",
    "    ↱ \\Rsh\t⇘ \\Searrow\t⇙ \\Swarrow\t⇑ \\Uparrow\n",
    "    ⇕ \\Updownarrow\t↺ \\circlearrowleft\t↻ \\circlearrowright\t↶ \\curvearrowleft\n",
    "    ↷ \\curvearrowright\t⤎ \\dashleftarrow\t⤏ \\dashrightarrow\t↓ \\downarrow\n",
    "    ⇊ \\downdownarrows\t⇃ \\downharpoonleft\t⇂ \\downharpoonright\t↩ \\hookleftarrow\n",
    "    ↪ \\hookrightarrow\t⇝ \\leadsto\t← \\leftarrow\t↢ \\leftarrowtail\n",
    "    ↽ \\leftharpoondown\t↼ \\leftharpoonup\t⇇ \\leftleftarrows\t↔ \\leftrightarrow\n",
    "    ⇆ \\leftrightarrows\t⇋ \\leftrightharpoons\t↭ \\leftrightsquigarrow\t↜ \\leftsquigarrow\n",
    "    ⟵ \\longleftarrow\t⟷ \\longleftrightarrow\t⟼ \\longmapsto\t⟶ \\longrightarrow\n",
    "    ↫ \\looparrowleft\t↬ \\looparrowright\t↦ \\mapsto\t⊸ \\multimap\n",
    "    ⇍ \\nLeftarrow\t⇎ \\nLeftrightarrow\t⇏ \\nRightarrow\t↗ \\nearrow\n",
    "    ↚ \\nleftarrow\t↮ \\nleftrightarrow\t↛ \\nrightarrow\t↖ \\nwarrow\n",
    "    → \\rightarrow\t↣ \\rightarrowtail\t⇁ \\rightharpoondown\t⇀ \\rightharpoonup\n",
    "    ⇄ \\rightleftarrows\t⇄ \\rightleftarrows\t⇌ \\rightleftharpoons\t⇌ \\rightleftharpoons\n",
    "    ⇉ \\rightrightarrows\t⇉ \\rightrightarrows\t↝ \\rightsquigarrow\t↘ \\searrow\n",
    "    ↙ \\swarrow\t→ \\to\t↞ \\twoheadleftarrow\t↠ \\twoheadrightarrow\n",
    "    ↑ \\uparrow\t↕ \\updownarrow\t↕ \\updownarrow\t↿ \\upharpoonleft\n",
    "    ↾ \\upharpoonright\t⇈ \\upuparrows\n",
    "\n",
    "\n",
    "    $ \\$ Å \\AA\tℲ \\Finv\t⅁ \\Game\n",
    "    ℑ \\Im\t¶ \\P\tℜ \\Re\t§ \\S\n",
    "    ∠ \\angle\t‵ \\backprime\t★ \\bigstar\t■ \\blacksquare\n",
    "    ▴ \\blacktriangle\t▾ \\blacktriangledown\t⋯ \\cdots\t✓ \\checkmark\n",
    "    ® \\circledR\tⓈ \\circledS\t♣ \\clubsuit\t∁ \\complement\n",
    "    © \\copyright\t⋱ \\ddots\t♢ \\diamondsuit\tℓ \\ell\n",
    "    ∅ \\emptyset\tð \\eth\t∃ \\exists\t♭ \\flat\n",
    "    ∀ \\forall\tħ \\hbar\t♡ \\heartsuit\tℏ \\hslash\n",
    "    ∭ \\iiint\t∬ \\iint\tı \\imath\t∞ \\infty\n",
    "    ȷ \\jmath\t… \\ldots\t∡ \\measuredangle\t♮ \\natural\n",
    "    ¬ \\neg\t∄ \\nexists\t∰ \\oiiint\t∂ \\partial\n",
    "    ′ \\prime\t♯ \\sharp\t♠ \\spadesuit\t∢ \\sphericalangle\n",
    "    ß \\ss\t▿ \\triangledown\t∅ \\varnothing\t▵ \\vartriangle\n",
    "    ⋮ \\vdots\t℘ \\wp\t¥ \\yen"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 28236 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "t = np.arange(0, 2.0, 0.01)\n",
    "sin = np.sin(2*np.pi*t)\n",
    "\n",
    "plt.plot(t,sin)\n",
    "plt.title(r'$\\alpha_i > \\beta_i $', fontsize = 18)\n",
    "plt.text(0.50, 0.50 , r'$\\mathcal{A}sin(2 \\omega t)$',fontsize = 18)\n",
    "plt.text(1,-0.75, r'$\\sum_{i=0}^\\infty x_i$',fontsize= 15)\n",
    "plt.xlabel('time(s)')\n",
    "plt.ylabel('volts(mV)')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18716 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(0, 5.0 , 0.01)\n",
    "cos = np.cos(2*np.pi*x)\n",
    "\n",
    "plt.plot(x , cos, lw = 1)\n",
    "plt.annotate('peak',xy= (2,1),xytext = (3,1.5) , arrowprops = dict(facecolor= 'g',shrink = 0.05)\n",
    "             , ha = 'right',va = 'top')\n",
    "plt.ylim(-2,1.5)\n",
    "# plt.xlim(-2, 7)\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Class\tName\tAttrs\n",
    "    Circle\tcircle\tpad=0.3\n",
    "    DArrow\tdarrow\tpad=0.3\n",
    "    LArrow\tlarrow\tpad=0.3\n",
    "    RArrow\trarrow\tpad=0.3\n",
    "    Round\tround\tpad=0.3,rounding_size=None\n",
    "    Round4\tround4\tpad=0.3,rounding_size=None\n",
    "    Roundtooth\troundtooth\tpad=0.3,tooth_size=None\n",
    "    Sawtooth\tsawtooth\tpad=0.3,tooth_size=None\n",
    "    Square\tsquare\tpad=0.3\n",
    "    \n",
    "    angle\tangleA=90,angleB=0,rad=0.0\n",
    "    angle3\tangleA=90,angleB=0\n",
    "    arc\tangleA=0,angleB=0,armA=None,armB=None,rad=0.0\n",
    "    arc3\trad=0.0\n",
    "    bar\tarmA=0.0,armB=0.0,fraction=0.3,angle=None\n",
    "    \n",
    "    -\tNone\n",
    "    ->\thead_length=0.4,head_width=0.2\n",
    "    -[\twidthB=1.0,lengthB=0.2,angleB=None\n",
    "    |-|\twidthA=1.0,widthB=1.0\n",
    "    -|>\thead_length=0.4,head_width=0.2\n",
    "    <-\thead_length=0.4,head_width=0.2\n",
    "    <->\thead_length=0.4,head_width=0.2\n",
    "    <|-\thead_length=0.4,head_width=0.2\n",
    "    <|-|>\thead_length=0.4,head_width=0.2\n",
    "    fancy\thead_length=0.4,head_width=0.4,tail_width=0.4\n",
    "    simple\thead_length=0.5,head_width=0.5,tail_width=0.2\n",
    "    wedge\ttail_width=0.3,shrink_factor=0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 24576 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "x = np.arange(0,2.0,0.01)\n",
    "sin =1+ np.sin(2*np.pi*x)\n",
    "\n",
    "fig , ax = plt.subplots()\n",
    "ax.plot(x, sin)\n",
    "ax.grid(True)\n",
    "# plt.xlabel('time(s)')\n",
    "# plt.ylabel('voltage(mV)')\n",
    "# plt.title('Simple plot')\n",
    "ax.set(xlabel='time(s)',ylabel = 'voltage(mV)',title = 'Simple Plot')\n",
    "fig.savefig('test.png')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.colorbar.Colorbar at 0x7f82f02c6cc0>"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 65188 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.image as mi\n",
    "\n",
    "img = mi.imread('image')\n",
    "# print(img)\n",
    "plt.imshow(img)\n",
    "plt.xticks([])\n",
    "plt.yticks([])\n",
    "\n",
    "pseudo = img[:,:,0]\n",
    "plt.imshow(pseudo)\n",
    "# plt.imshow(pseudo , cmap ='hot')\n",
    "# plt.imshow(pseudo , cmap = 'nipy_spectral')\n",
    "# plt.imshow(pseudo , clim=(0.0,0.7))\n",
    "plt.colorbar()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
