{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!DOCTYPE html>\n",
    "<html>\n",
    "<body>\n",
    "<div align=\"center\">\n",
    "<h3>Prepared by Asif Bhat</h3>\n",
    "    \n",
    "<h1>Data Visualization With Python (Matplotlib - Part 1)</h1>\n",
    "\n",
    "<h3>Follow Me on - <a href=\"https://www.linkedin.com/in/asif-bhat/\">LinkedIn</a>&nbsp; <a href=\"https://mobile.twitter.com/_asifbhat_\">Twitter</a>&nbsp; <a href=\"https://www.instagram.com/datasciencescoop/?hl=en\">Instagram</a>&nbsp; <a href=\"https://www.facebook.com/datasciencescoop/\">Facebook</a></h3>\n",
    "</div>\n",
    "\n",
    "</div>\n",
    "</body>\n",
    "</html>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib as mpl\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Graph Styling\n",
    "# https://tonysyu.github.io/raw_content/matplotlib-style-gallery/gallery.html\n",
    "plt.style.use('seaborn-darkgrid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Line Graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 10860 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# By default Plot() function will draw a line chart.\n",
    "x = np.array([1,2,3,4,5,6])\n",
    "y = np.power(x,3)\n",
    "plt.plot(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20752 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0, 10, 1000) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Recover default matplotlib settings\n",
    "mpl.rcParams.update(mpl.rcParamsDefault)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 34028 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0, 10, 1000) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.style.use('seaborn-darkgrid')\n",
    "%matplotlib inline "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25572 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 1000) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25712 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Solid blue line will be plotted using the argument \"b-\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 1000) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'b-')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 26740 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Solid red line will be plotted using the argument \"r-\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 1000) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'r-')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12504 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Plot green dots using the argument \"go\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 40) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'go')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12544 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Plotting red dots using the argument \"ro\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 40) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'ro')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12032 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Plotting traingular dots using the argument \"r^\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 40) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'r^')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12304 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Plotting traingular dots using the argument \"rv\"\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.linspace(0, 10, 40) \n",
    "y = np.sin(x) # Sine Graph\n",
    "plt.plot(x,y,'rv')\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20772 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Plotting multiple sets of data\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.array([1,2,3,4,5,6])\n",
    "y1 = np.power(x,2)\n",
    "y2 = np.power(x,3)\n",
    "plt.plot(x,y1, \"b-\" , label = '$y1 = x^2$') # Setting up legends \n",
    "plt.plot(x,y2, \"r-\" ,label ='$y2 = x^3$')   # Setting up legends\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.legend()\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 50768 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Plotting multiple sets of data\n",
    "x = np.linspace(0, 10, 2000)  \n",
    "plt.figure(figsize=(10,6))\n",
    "plt.plot(x,np.sin(x) , label = '$Sin(X)$')\n",
    "plt.plot(x,np.cos(x) , label = '$cos(X)$')\n",
    "plt.xlabel(r'$X$' , fontsize = 18)\n",
    "plt.ylabel(r'$Y$' , fontsize = 18)\n",
    "plt.title(\"$Sin(x) $  $ & $  $ Cos(x)$\" ,fontsize = 14)\n",
    "plt.legend(loc = 'upper right') # Legend will be placed at upper right position\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18208 characters]\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Changing the line style\n",
    "plt.figure(figsize=(10,5))\n",
    "x = np.array([1,2,3,4,5,6])\n",
    "y1 = np.power(x,2)\n",
    "y2 = np.power(x,3)\n",
    "plt.plot(x,y1, \"b-\" , label = '$y1 = x^2$') # Setting up legends \n",
    "plt.plot(x, y2,color='red',linewidth=1.0,linestyle='--')   # Setting up legends\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.legend(loc='upper center', fontsize='large')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 125988 characters]\n",
      "text/plain": [
       "<Figure size 1152x648 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Line Styling\n",
    "x = np.linspace(0, 10, 2000)  \n",
    "plt.figure(figsize=(16, 9))\n",
    "plt.plot(x,np.sin(x) , label = '$Sin(X) $  $ Dashed $' , linestyle='dashed')\n",
    "plt.plot(x+1,np.sin(x) , label = '$Sin(X) $  $ Dashdot  $' , linestyle='dashdot')\n",
    "plt.plot(x,np.cos(x) , label = '$cos(X) $ $ Solid $' , linestyle='solid')\n",
    "plt.plot(x+1,np.cos(x) , label = '$cos(X)$ $ Dotted $' , linestyle='dotted')\n",
    "plt.xlabel(r'$X$' , fontsize = 18)\n",
    "plt.ylabel(r'$Y$' , fontsize = 18)\n",
    "plt.title(\"$Sin(x) $  $ & $  $ Cos(x)$\" ,fontsize = 14)\n",
    "plt.legend(loc = 'upper right' , fontsize = 14 , bbox_to_anchor=(1.2, 1.0)) # Legend will be placed at upper right position\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 125988 characters]\n",
      "text/plain": [
       "<Figure size 1152x648 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Line Styling\n",
    "x = np.linspace(0, 10, 2000)  \n",
    "plt.figure(figsize=(16, 9))\n",
    "plt.plot(x,np.sin(x) , label = '$Sin(X) $  $ Dashed $' , linestyle='--')\n",
    "plt.plot(x+1,np.sin(x) , label = '$Sin(X) $  $ Dashdot  $' , linestyle='-.')\n",
    "plt.plot(x,np.cos(x) , label = '$cos(X) $ $ Solid $' , linestyle='-')\n",
    "plt.plot(x+1,np.cos(x) , label = '$cos(X)$ $ Dotted $' , linestyle=':')\n",
    "plt.xlabel(r'$X$' , fontsize = 18)\n",
    "plt.ylabel(r'$Y$' , fontsize = 18)\n",
    "plt.title(\"$Sin(x) $  $ & $  $ Cos(x)$\" ,fontsize = 14)\n",
    "plt.legend(loc = 'upper right' , fontsize = 14 , bbox_to_anchor=(1.2, 1.0)) # Legend will be placed at upper right position\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 40356 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Shading Regions with fill_between() function\n",
    "x = np.linspace(0, 10, 2000)  \n",
    "plt.figure(figsize=(10,6))\n",
    "plt.plot(x,np.sin(x) , label = '$Sin(X)$')\n",
    "plt.plot(x,np.cos(x) , label = '$cos(X)$')\n",
    "plt.fill_between(x,0,np.sin(x))\n",
    "plt.fill_between(x,0,np.cos(x))\n",
    "plt.xlabel(r'$X$' , fontsize = 18)\n",
    "plt.ylabel(r'$Y$' , fontsize = 18)\n",
    "plt.title(\"$Sin(x) $  $ & $  $ Cos(x)$\" ,fontsize = 14)\n",
    "plt.legend(loc = 'lower left') # Legend will be placed at lower left position\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 15340 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Changing Legend position & font\n",
    "x = np.array([1,2,3,4,5,6])\n",
    "y1 = np.power(x,2)\n",
    "y2 = np.power(x,3)\n",
    "plt.plot(x,y1, \"b-\" , label = '$y1 = x^2$') # Setting up legends \n",
    "plt.plot(x,y2, \"r-\" ,label ='$y2 = x^3$')   # Setting up legends\n",
    "plt.xlabel(\"X - Axis\")\n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.legend(loc='upper center', fontsize='large')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23252 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Changing line width\n",
    "plt.figure(figsize=(10,6))\n",
    "x= [1,2,3,4,5,6,7,8,9] \n",
    "y= [7,8,9,10,7,11,12,13,14]\n",
    "y2 = [7,7,7,7,7,7,7,7,7]\n",
    "plt.plot(x , y, linewidth = 4 ,label = 'Line -1')  # Changing line width\n",
    "plt.plot(x , y2, linewidth = 3,label = 'Line - 2')\n",
    "plt.xlabel('X Axis Label')\n",
    "plt.ylabel('Y Axis Label')\n",
    "plt.title ('Line Graph')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23384 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Plot with Grid Lines\n",
    "plt.figure(figsize=(10,6))\n",
    "x= [1,2,3,4,5,6,7,8,9] \n",
    "y= [7,8,9,10,7,11,12,13,14]\n",
    "y2 = [7,7,7,7,7,7,7,7,7]\n",
    "plt.plot(x , y, linewidth = 4 ,label = 'Line -1')  # Changing line width\n",
    "plt.plot(x , y2, linewidth = 3,label = 'Line - 2')\n",
    "plt.xlabel('X Axis Label')\n",
    "plt.ylabel('Y Axis Label')\n",
    "plt.title ('Line Graph')\n",
    "plt.legend()\n",
    "plt.grid(b=True , linestyle = '-' , which = 'major' , color = 'grey') # Grid Lines\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20460 characters]\n",
      "text/plain": [
       "<Figure size 864x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Setting the background color\n",
    "x = np.array([1,2,3,4,5,6])\n",
    "y1 = np.power(x,2)\n",
    "y2 = np.power(x,3)\n",
    "plt.figure(figsize=(12,5)) # Setting the figure size\n",
    "ax = plt.axes()\n",
    "ax.set_facecolor(\"darkgrey\") # Setting the background color by using Hex code\n",
    "plt.plot(x,y1,\"bo-\", x,y2, \"ro-\")\n",
    "plt.xlabel(\"X - Axis\") \n",
    "plt.ylabel(\"Y - Axis\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 42208 characters]\n",
      "text/plain": [
       "<Figure size 1008x432 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Display multiple plots in one figure (1 row & 2 columns)\n",
    "plt.figure(figsize=(14,6))\n",
    "x = np.linspace(0, 10, 100) \n",
    "y1 = np.sin(x) # Sine Graph\n",
    "y2 = np.cos(x) # cosine graph\n",
    "plt.subplot(1,2,1)\n",
    "plt.plot(x,y1)\n",
    "plt.subplot(1,2,2)\n",
    "plt.plot(x,y2)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 49212 characters]\n",
      "text/plain": [
       "<Figure size 864x432 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Display multiple plots in one figure (2 row & 1 columns)\n",
    "\n",
    "plt.figure(figsize=(12,6))\n",
    "x = np.linspace(0, 10, 100) \n",
    "y1 = np.sin(x) # Sine Graph\n",
    "y2 = np.cos(x) # cosine graph\n",
    "\n",
    "plt.subplot(2,1,1)\n",
    "plt.plot(x,y1, \"b-\")\n",
    "\n",
    "plt.subplot(2,1,2)\n",
    "plt.plot(x,y2, \"r-\")\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 201708 characters]\n",
      "text/plain": [
       "<Figure size 1440x1440 with 9 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# # Display multiple plots in one figure using subplots()\n",
    "x = np.arange(-50,50)\n",
    "y1 = np.power(x,2)\n",
    "y2 = np.power(x,3)\n",
    "y3 = np.sin(x)\n",
    "y4 = np.cos(x)\n",
    "y5 = np.tan(x)\n",
    "y6 = np.tanh(x)\n",
    "y7 = np.sinh(x)\n",
    "y8 = np.cosh(x)\n",
    "y9 = np.exp(x)\n",
    "\n",
    "fig1 , ax1 = plt.subplots(nrows=3,ncols=3 , figsize = (20,20)) # Create a figure and subplots\n",
    "ax1[0,0].plot(x,y1,\"tab:blue\") # set the color of the line chart\n",
    "ax1[0,0].set_title(\"Square Function\") # setting title of subplot\n",
    "ax1[0,0].set_xlabel(r'$X$' , fontsize = 18) #Set the label for the x-axis\n",
    "ax1[0,0].set_ylabel(r'$Y$' , fontsize = 18) #Set the label for the y-axis\n",
    "\n",
    "\n",
    "ax1[0,1].plot(x,y2,\"tab:orange\")\n",
    "ax1[0,1].set_title(\"Cubic Function\")\n",
    "ax1[0,1].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[0,1].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "ax1[0,2].plot(x,y3,\"tab:green\")\n",
    "ax1[0,2].set_title(\"Sine Function\")\n",
    "ax1[0,2].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[0,2].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "\n",
    "ax1[1,0].plot(x,y4,\"b-\")\n",
    "ax1[1,0].set_title(\"Cosine Function\")\n",
    "ax1[1,0].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[1,0].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "\n",
    "ax1[1,1].plot(x,y5,\"r-\")\n",
    "ax1[1,1].set_title(\"Tangent Function\")\n",
    "ax1[1,1].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[1,1].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "ax1[1,2].plot(x,y6,\"g-\")\n",
    "ax1[1,2].set_title(\"Hyperbolic Tangent\")\n",
    "ax1[1,2].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[1,2].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "ax1[2,0].plot(x,y7,\"m-\")\n",
    "ax1[2,0].set_title(\"Hyperbolic Sine\")\n",
    "ax1[2,0].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[2,0].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "ax1[2,1].plot(x,y8,\"y-\")\n",
    "ax1[2,1].set_title(\"Hyperbolic Cosine\")\n",
    "ax1[2,1].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[2,1].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "ax1[2,2].plot(x,y9,\"k-\")\n",
    "ax1[2,2].set_title(\"Exponential Function\")\n",
    "ax1[2,2].set_xlabel(r'$X$' , fontsize = 18)\n",
    "ax1[2,2].set_ylabel(r'$Y$' , fontsize = 18)\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "iteration Number :- 1\n",
      "X1 Value :- [10, 20, 30, 40, 50]\n",
      "Y value (i) :- [1, 2, 3, 4, 5]\n",
      "iteration Number :- 2\n",
      "X1 Value :- [10, 20, 30, 40, 50]\n",
      "Y value (i) :- [10, 20, 30, 40, 50]\n",
      "iteration Number :- 3\n",
      "X1 Value :- [10, 20, 30, 40, 50]\n",
      "Y value (i) :- [60, 70, 80, 90, 100]\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 20012 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "y = [[1,2,3,4,5] , [10,20,30,40,50],[60,70,80,90,100] ]\n",
    "cnt =0\n",
    "plt.figure(figsize=(10,6))\n",
    "for i in y:\n",
    "    x1 = [10,20,30,40,50]\n",
    "    cnt +=1\n",
    "    print ('iteration Number :- {}'.format(cnt))\n",
    "    print ('X1 Value :- {}'.format(x1))\n",
    "    print('Y value (i) :- {}'.format(i))\n",
    "    plt.plot(x1,i)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Bar Graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 288,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5692 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "id1 = np.arange(1,10)\n",
    "score = np.arange(20,110,10)\n",
    "plt.bar(id1,score)\n",
    "plt.xlabel('Student ID')\n",
    "plt.ylabel('Score')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 6796 characters]\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "id1 = np.arange(1,10)\n",
    "score = np.arange(20,110,10)\n",
    "plt.figure(figsize=(8,5)) # Setting the figure size\n",
    "ax = plt.axes()\n",
    "ax.set_facecolor(\"#ECF0F1\") # Setting the background color by specifying the HEX Code\n",
    "plt.bar(id1,score,color = '#FFA726')\n",
    "plt.xlabel(r'$Student $ $ ID$')\n",
    "plt.ylabel(r'$Score$')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 290,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 8556 characters]\n",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Plotting multiple sets of data\n",
    "x1= [1,3,5,7] \n",
    "x2=[2,4,6,8]\n",
    "y1 = [7,7,7,7]\n",
    "y2= [17,18,29,40]\n",
    "plt.figure(figsize=(8,6))\n",
    "ax = plt.axes()\n",
    "ax.set_facecolor(\"white\")\n",
    "plt.bar(x1,y1,label = \"First\",color = '#42B300') # First set of data\n",
    "plt.bar(x2,y2,label = \"Second\",color = '#94E413') # Second set of data\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 291,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5056 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Horizontal Bar Chart\n",
    "Age = [28,33,43,45,57]\n",
    "Name = [\"Asif\", \"Steve\", 'John', \"Ravi\", \"Basit\"]\n",
    "plt.barh(Name,Age, color =\"yellowgreen\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 293,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 4816 characters]\n",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Changing the width of Bars\n",
    "num1 = np.array([1,3,5,7,9])\n",
    "num2 = np.array([2,4,6,8,10])\n",
    "plt.figure(figsize=(8,4))\n",
    "plt.bar(num1, num1**2, width=0.2 , color = '#FF6F00')\n",
    "plt.bar(num2, num2**2, width=0.2 , color = '#FFB300')\n",
    "plt.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 294,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 294,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 9140 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Displaying values at the top of vertical bars\n",
    "num1 = np.array([1,3,5,7,9])\n",
    "num2 = np.array([2,4,6,8,10])\n",
    "plt.figure(figsize=(10,6))\n",
    "plt.bar(num1, num1**2, width=0.3 , color = '#FF6F00')\n",
    "plt.bar(num2, num2**2, width=0.3 , color = '#FFB300')\n",
    "for x,y in zip(num1,num1**2):\n",
    "    plt.text(x, y+0.05, '%d' % y, ha='center' , va= 'bottom')\n",
    "for x,y in zip(num2,num2**2):\n",
    "    plt.text(x, y+0.05, '%d' % y, ha='center' , va= 'bottom')\n",
    "plt.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 295,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 16952 characters]\n",
      "text/plain": [
       "<Figure size 1152x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(1,21)\n",
    "plt.figure(figsize=(16,8))\n",
    "y1 = np.random.uniform(0.1,0.7,20)\n",
    "y2 = np.random.uniform(0.1,0.7,20)\n",
    "\n",
    "\n",
    "plt.bar(x, +y1, facecolor='#C0CA33', edgecolor='white') #specify edgecolor by name\n",
    "plt.bar(x, -y2, facecolor='#FF9800', edgecolor='white')\n",
    "\n",
    "for x,y in zip(x,y1):\n",
    "    plt.text(x, y+0.05, '%.2f' % y, ha='center' , va= 'bottom', fontsize = 10)\n",
    "    \n",
    "plt.xlim(0,21)\n",
    "plt.ylim(-1.25,+1.25)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stacked Vertical Bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 296,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12068 characters]\n",
      "text/plain": [
       "<Figure size 360x504 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.style.use('seaborn-darkgrid')\n",
    "x1= ['Asif','Basit','Ravi','Minil'] \n",
    "y1= [17,18,29,40]\n",
    "y2 = [20,21,22,23]\n",
    "plt.figure(figsize=(5,7))\n",
    "plt.bar(x1,y1,label = \"Open Tickets\",width = 0.5,color = '#FF6F00')\n",
    "plt.bar(x1,y2,label = \"Closed Tickets\",width = 0.5 ,bottom = y1 , color = '#FFB300')\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 297,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 14160 characters]\n",
      "text/plain": [
       "<Figure size 360x504 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.style.use('seaborn-darkgrid')\n",
    "x1= ['Asif','Basit','Ravi','Minil'] \n",
    "y1= np.array([17,18,29,40])\n",
    "y2 =np.array([20,21,22,23])\n",
    "y3 =np.array([5,9,11,12])\n",
    "plt.figure(figsize=(5,7))\n",
    "plt.bar(x1,y1,label = \"Open Tickets\",width = 0.5,color = '#FF6F00')\n",
    "plt.bar(x1,y2,label = \"Closed Tickets\",width = 0.5 ,bottom = y1 , color = '#FFB300')\n",
    "plt.bar(x1,y3,label = \"Cancelled Tickets\",width = 0.5 ,bottom = y1+y2 , color = '#F7DC6F')\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Grouped Bar Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 298,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 15056 characters]\n",
      "text/plain": [
       "<Figure size 504x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3])"
      ]
     },
     "execution_count": 298,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Grouped Bar Chart\n",
    "\n",
    "plt.figure(figsize=(7,9))\n",
    "\n",
    "# set width of bar\n",
    "barWidth = 0.25\n",
    " \n",
    "# set height of bar\n",
    "y1= np.array([17,18,29,40])\n",
    "y2 =np.array([20,21,22,23])\n",
    "y3 =np.array([5,9,11,12])\n",
    " \n",
    "# Set position of bar on X axis\n",
    "pos1 = np.arange(len(y1))\n",
    "pos2 = [x + barWidth for x in pos1]\n",
    "pos3 = [x + barWidth for x in pos2]\n",
    "\n",
    "# Make the plot\n",
    "plt.bar(pos1, y1, color='#FBC02D', width=barWidth, label='Open')\n",
    "plt.bar(pos2, y2, color='#F57F17', width=barWidth, label='Closed')\n",
    "plt.bar(pos3, y3, color='#E65100', width=barWidth, label='Cancelled')\n",
    "\n",
    "# Add xticks on the middle of the group bars\n",
    "plt.xlabel('Assignee', fontweight='bold')\n",
    "plt.ylabel('Number of Tickets', fontweight='bold')\n",
    "plt.xticks([i + barWidth for i in range(len(y1))], ['Asif', 'Basit', 'Ravi', 'Minil'])\n",
    "\n",
    "# Create legend & Show graphic\n",
    "plt.legend()\n",
    "plt.show()\n",
    "np.arange(len(y1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Stacked Vertical Bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 299,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 11440 characters]\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.style.use('seaborn-darkgrid')\n",
    "x1= ['Asif','Basit','Ravi','Minil'] \n",
    "y1= [17,18,29,40]\n",
    "y2 = [20,21,22,23]\n",
    "plt.figure(figsize=(8,5))\n",
    "plt.barh(x1,y1,label = \"Open Tickets\",color = '#FF6F00')\n",
    "plt.barh(x1,y2,label = \"Closed Tickets\", left = y1 , color = '#FFB300')\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Displaying values in Bar Charts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 300,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 14556 characters]\n",
      "text/plain": [
       "<Figure size 360x504 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Displaying values in the stacked vertical bars using plt.text()\n",
    "plt.style.use('seaborn-darkgrid')\n",
    "x1= ['Asif','Basit','Ravi','Minil'] \n",
    "y1= [17,18,29,40]\n",
    "y2 = [20,21,22,23]\n",
    "plt.figure(figsize=(5,7))\n",
    "plt.bar(x1,y1,label = \"Open Tickets\",width = 0.5,color = '#FF6F00')\n",
    "plt.bar(x1,y2,label = \"Closed Tickets\",width = 0.5 ,bottom = y1 , color = '#FFB300')\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "for x,y in zip(x1,y1):\n",
    "    plt.text(x, y-10, '%d' % y, ha='center' , va= 'bottom')\n",
    "\n",
    "for x,y,z in zip(x1,y2,y1):\n",
    "    plt.text(x, y+z-10, '%d' % y, ha='center' , va= 'bottom')\n",
    "    \n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 301,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13948 characters]\n",
      "text/plain": [
       "<Figure size 576x360 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Displaying values in the stacked horizontal bars using plt.text()\n",
    "plt.style.use('seaborn-darkgrid')\n",
    "x1= ['Asif','Basit','Ravi','Minil'] \n",
    "y1= [17,18,29,40]\n",
    "y2 = [20,21,22,23]\n",
    "plt.figure(figsize=(8,5))\n",
    "plt.barh(x1,y1,label = \"Open Tickets\",color = '#FF6F00')\n",
    "plt.barh(x1,y2,label = \"Closed Tickets\", left = y1 , color = '#FFB300')\n",
    "plt.xlabel('$X$')\n",
    "plt.ylabel('$Y$')\n",
    "\n",
    "for x,y in zip(x1,y1):\n",
    "    plt.text(y-10, x, '%d' % y, ha='center' , va= 'bottom')\n",
    "    \n",
    "for x,y,z in zip(x1,y2,y1):\n",
    "    plt.text(y+z-10, x, '%d' % y, ha='center' , va= 'bottom')\n",
    "    \n",
    "plt.title ('$Bar $ $ Chart$')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 302,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 21180 characters]\n",
      "text/plain": [
       "<Figure size 504x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Displaying values at the top of the Grouped Bar Chart using plt.text()\n",
    "plt.figure(figsize=(7,9))\n",
    "\n",
    "# set width of bar\n",
    "barWidth = 0.25\n",
    " \n",
    "# set height of bar\n",
    "y1= np.array([17,18,29,40])\n",
    "y2 =np.array([20,21,22,23])\n",
    "y3 =np.array([5,9,11,12])\n",
    " \n",
    "# Set position of bar on X axis\n",
    "pos1 = np.arange(len(y1))\n",
    "pos2 = [x + barWidth for x in pos1]\n",
    "pos3 = [x + barWidth for x in pos2]\n",
    "\n",
    "# Make the plot\n",
    "plt.bar(pos1, y1, color='#FBC02D', width=barWidth, label='Open')\n",
    "plt.bar(pos2, y2, color='#F57F17', width=barWidth, label='Closed')\n",
    "plt.bar(pos3, y3, color='#E65100', width=barWidth, label='Cancelled')\n",
    "\n",
    "# Add xticks on the middle of the group bars\n",
    "plt.xlabel('Assignee', fontweight='bold')\n",
    "plt.ylabel('Number of Tickets', fontweight='bold')\n",
    "plt.xticks([i + barWidth for i in range(len(y1))], ['Asif', 'Basit', 'Ravi', 'Minil'])\n",
    "\n",
    "for x,y in zip(pos1,y1):\n",
    "    plt.text(x, y, '%d' % y, ha='center' , va= 'bottom')\n",
    "    \n",
    "for x,y in zip(pos2,y2):\n",
    "    plt.text(x, y, '%d' % y, ha='center' , va= 'bottom')\n",
    "\n",
    "for x,y in zip(pos3,y3):\n",
    "    plt.text(x, y, '%d' % y, ha='center' , va= 'bottom')\n",
    "\n",
    "plt.title ('$Grouped $  $ Bar $  $ Chart$')\n",
    "\n",
    "# Create legend & Show graphic\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Scatter Graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 303,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12800 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 13748 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 14540 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 14760 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x1 = np.array([250,150,350,252,450,550,455,358,158,355])\n",
    "y1 =np.array([40,50,80, 90, 100,50,60,88,54,45])\n",
    "\n",
    "\n",
    "x2 = np.array([200,100,300,220,400,500,450,380,180,350])\n",
    "y2 = np.array([400,500,800, 900, 1000,500,600,808,504,405])\n",
    "\n",
    "#Graph - 1\n",
    "plt.scatter(x1,y1)\n",
    "plt.xlabel('$Time $ $ Spent$' , fontsize = 12)\n",
    "plt.ylabel('$Score$' , fontsize = 12)\n",
    "plt.title ('Scatter Graph')\n",
    "plt.show()\n",
    "\n",
    "#Graph - 2\n",
    "plt.scatter(x2,y2 ,color = 'r')\n",
    "plt.xlabel('$Time $ $ Spent$' , fontsize = 12)\n",
    "plt.ylabel('$Score$' , fontsize = 12)\n",
    "plt.title ('Scatter Graph')\n",
    "plt.show()\n",
    "\n",
    "#Graph - 3\n",
    "plt.scatter(x1,y1 ,label = 'Class 1')\n",
    "plt.scatter(x2,y2 ,label = 'Class 2',color ='r')\n",
    "plt.xlabel('$Time $ $ Spent$' , fontsize = 12)\n",
    "plt.ylabel('$Score$' , fontsize = 12)\n",
    "plt.title ('Scatter Graph')\n",
    "plt.legend()\n",
    "plt.show()\n",
    "\n",
    "#Graph - 4\n",
    "plt.scatter(x1,y1 ,label = 'Class 1',marker='o' , color = 'm')\n",
    "plt.scatter(x2,y2 ,label = 'Class 2',marker='v',color ='r')\n",
    "plt.xlabel('$Time $ $ Spent$' , fontsize = 12)\n",
    "plt.ylabel('$Score$' , fontsize = 12)\n",
    "plt.title ('Scatter Graph')\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 304,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 40336 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10,6))\n",
    "x = np.random.normal(0,10,1000)\n",
    "y = np.random.normal(0,10,1000)\n",
    "plt.scatter(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 305,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25948 characters]\n",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8,6))\n",
    "x = np.random.random(10)\n",
    "y = np.random.random(10)\n",
    "# \"alpha\" is used for softnening colors\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='r', s=50 , alpha=0.6 , label = 'One' )\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='b', s=100 , alpha=0.6 , label = 'Two')\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='g', s=150 , alpha=0.6 , label = 'Three')\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='y', s=200 , alpha=0.6 , label = 'Four')\n",
    "plt.legend(bbox_to_anchor=(1.0, 1.0) , shadow=True, fontsize='x-large')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 306,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25236 characters]\n",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Changing label color\n",
    "plt.figure(figsize=(8,6))\n",
    "x = np.random.random(10)\n",
    "y = np.random.random(10)\n",
    "# \"alpha\" is used for softnening colors\n",
    "plt.rcParams['text.color'] = 'red' # Label Color\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='r', s=50 , alpha=0.6 , label = 'One' )\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='b', s=100 , alpha=0.6 , label = 'Two')\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='g', s=150 , alpha=0.6 , label = 'Three')\n",
    "plt.scatter(np.random.random(10),np.random.random(10),c='y', s=200 , alpha=0.6 , label = 'Four')\n",
    "plt.legend(bbox_to_anchor=(1.0, 1.0) , shadow=True, fontsize='x-large')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 307,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Recover default matplotlib settings\n",
    "mpl.rcParams.update(mpl.rcParamsDefault)\n",
    "%matplotlib inline \n",
    "plt.style.use('seaborn-darkgrid')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pie Charts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23292 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Display percentage and actual value in Pie Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 29404 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Display percentage in Pie Chart using autopct='%1.1f%%' \n",
    "plt.figure(figsize=(8,8))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , shadow='true', autopct='%1.1f%%', explode=[0,0 , 0 , 0])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 32120 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8,8))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "total = np.sum(tickets)\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "\n",
    "def val_per(x): \n",
    "    return '{:.2f}%\\n({:.0f})'.format(x, total*x/100)\n",
    "\n",
    "colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , shadow='true', autopct=val_per, explode=[0,0 , 0 , 0])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Explode Slice in Pie Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 33192 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Explode 4th Slice\n",
    "plt.figure(figsize=(8,8))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']\n",
    "# explode = [0,0,0,0.1] will explode the fourth slice\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , autopct='%1.1f%%' , shadow='true', explode=[0,0 , 0 , 0.1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 39596 characters]\n",
      "text/plain": [
       "<Figure size 576x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Explode 3rd & 4th Slice\n",
    "plt.figure(figsize=(8,8))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "label = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "color = ['#7CB342','#C0CA33','#FFB300','#F57C00']\n",
    "# explode = [0,0,0.1,0.1] will explode the 3rd & 4th slice\n",
    "plt.pie (tickets , labels= label , colors= color , startangle=45 ,autopct='%1.1f%%', shadow='true', explode=[0,0 , 0.1 , 0.1])\n",
    "plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Display multiple pie plots in one figure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 43844 characters]\n",
      "text/plain": [
       "<Figure size 1440x432 with 3 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(20,6))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "priority = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']\n",
    "company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "\n",
    "plt.subplot(1,3,1)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45)\n",
    "\n",
    "\n",
    "plt.subplot(1,3,2)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45)\n",
    "\n",
    "\n",
    "plt.subplot(1,3,3)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45)\n",
    "\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 93120 characters]\n",
      "text/plain": [
       "<Figure size 1440x936 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(20,13))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "priority = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']\n",
    "company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "\n",
    "\n",
    "plt.subplot(2,3,1)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45 , autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "plt.subplot(2,3,2)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45 , autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "plt.subplot(2,3,3)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45 , autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "\n",
    "plt.subplot(2,3,4)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45, autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "plt.subplot(2,3,5)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45 ,autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "plt.subplot(2,3,6)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45, autopct='%1.1f%%')\n",
    "\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Donut plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 27184 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 27220 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Changing background color\n",
    "fig = plt.figure(figsize=(9,9))\n",
    "fig.patch.set_facecolor('#DADADA') # Changing background color of donut chart\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='#DADADA') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Explode Slice in Donut Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 28068 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , explode=[0,0 , 0.0 , 0.1])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 28728 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , explode=[0,0 , 0.1 , 0.1])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 28540 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , explode=[0.03,0.03 , 0.03 , 0.03])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Displaying percentage and actual values in Donut Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 30184 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , autopct='%1.1f%%', explode=[0,0 , 0 , 0])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 29940 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , autopct='%1.1f%%', pctdistance=0.85 ,explode=[0,0 , 0 , 0])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 32748 characters]\n",
      "text/plain": [
       "<Figure size 648x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(9,9))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "total = np.sum(tickets)\n",
    "\n",
    "def val_per(x): \n",
    "    return '{:.2f}%\\n({:.0f})'.format(x, total*x/100)\n",
    "\n",
    "labels = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "plt.pie (tickets , labels= labels , colors= colors , startangle=45 , autopct=val_per, pctdistance=0.85 ,explode=[0,0 , 0 , 0])\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Display multiple Donut plots in one figure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 52316 characters]\n",
      "text/plain": [
       "<Figure size 1440x432 with 3 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(20,6))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "priority = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']\n",
    "company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "\n",
    "plt.subplot(1,3,1)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(1,3,2)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(1,3,3)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 104736 characters]\n",
      "text/plain": [
       "<Figure size 1440x936 with 6 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure(figsize=(20,13))\n",
    "tickets = [48 , 30 , 20 , 15]\n",
    "priority = ['Low' , 'Medium' , 'High' , 'Critical']\n",
    "status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']\n",
    "company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']\n",
    "colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']\n",
    "\n",
    "plt.subplot(2,3,1)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(2,3,2)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(2,3,3)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "\n",
    "plt.subplot(2,3,4)\n",
    "plt.pie (tickets , labels= priority , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(2,3,5)\n",
    "plt.pie (tickets , labels= status , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.subplot(2,3,6)\n",
    "plt.pie (tickets , labels= company , colors= colors , startangle=45)\n",
    "my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre\n",
    "p=plt.gcf()\n",
    "p.gca().add_artist(my_circle)\n",
    "\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Histogram"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 323,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 9528 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.random.normal(size = 2000)\n",
    "plt.hist(x, bins=40, color='yellowgreen')\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 324,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 8128 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.random.rand(2000)\n",
    "plt.hist(x, bins=30 ,color='#D4AC0D')\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 325,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13168 characters]\n",
      "text/plain": [
       "<Figure size 720x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Using Edge Color for readability\n",
    "plt.figure(figsize=(10,8))\n",
    "x = np.random.normal(size = 2000)\n",
    "plt.hist(x, bins=40, color='yellowgreen' , edgecolor=\"#6A9662\")\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Binning"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 326,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13008 characters]\n",
      "text/plain": [
       "<Figure size 720x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 11372 characters]\n",
      "text/plain": [
       "<Figure size 720x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 11212 characters]\n",
      "text/plain": [
       "<Figure size 720x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Binning\n",
    "plt.figure(figsize=(10,8))\n",
    "x = np.random.normal(size = 2000)\n",
    "plt.hist(x, bins=30, color='yellowgreen' , edgecolor=\"#6A9662\")\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()\n",
    "\n",
    "plt.figure(figsize=(10,8))\n",
    "plt.hist(x, bins=20, color='yellowgreen' , edgecolor=\"#6A9662\")\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()\n",
    "\n",
    "plt.figure(figsize=(10,8))\n",
    "plt.hist(x, bins=10, color='yellowgreen' , edgecolor=\"#6A9662\")\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Plotting Multiple Histograms"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 329,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 13684 characters]\n",
      "text/plain": [
       "<Figure size 576x792 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8,11))\n",
    "x = np.random.normal(-4,1,size = 800)\n",
    "y = np.random.normal(0,1.5,size = 800)\n",
    "z = np.random.normal(3.5,1,size = 800)\n",
    "plt.hist(x, bins=30, color='yellowgreen' , alpha=0.6)\n",
    "plt.hist(y, bins=30, color='#FF8F00' , alpha=0.6)\n",
    "plt.hist(z, bins=30, color='blue' , alpha=0.6)\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 330,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 14416 characters]\n",
      "text/plain": [
       "<Figure size 720x576 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Using Histogram to plot a cumulative distribution function\n",
    "plt.figure(figsize=(10,8))\n",
    "x = np.random.rand(2000)\n",
    "plt.hist(x, bins=30 ,color='#ffa41b' , edgecolor=\"#639a67\",cumulative=True)\n",
    "plt.gca().set(title='Histogram', ylabel='Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Area Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 331,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 33068 characters]\n",
      "text/plain": [
       "<Figure size 1152x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(1,31)\n",
    "y = np.random.normal(10,11,size=30)\n",
    "y = np.square(y)\n",
    "plt.figure(figsize=(16,6))\n",
    "plt.plot(x,y)\n",
    "plt.fill_between(x, y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Changing Fill Color"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 334,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 44844 characters]\n",
      "text/plain": [
       "<Figure size 1152x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(1,31)\n",
    "y = np.random.normal(10,11,size=30)\n",
    "y = np.square(y)\n",
    "plt.figure(figsize=(16,6))\n",
    "\n",
    "plt.fill_between( x, y, color=\"#baf1a1\")  # #Changing Fill color\n",
    "plt.plot(x, y, color='#7fcd91') # Color on edges\n",
    " \n",
    "plt.title(\"$ Area $  $ chart $\" , fontsize = 16)\n",
    "plt.xlabel(\"$X$\" , fontsize = 16)\n",
    "plt.ylabel(\"$Y$\" , fontsize = 16)\n",
    "\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Changing Fill Color and its transperancy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 336,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 59012 characters]\n",
      "text/plain": [
       "<Figure size 1152x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(1,31)\n",
    "y = np.random.normal(10,11,size=30)\n",
    "y = np.square(y)\n",
    "plt.figure(figsize=(16,6))\n",
    "\n",
    "plt.fill_between( x, y, color=\"#C8D700\" , alpha = 0.3) # Changing transperancy using Alpha parameter\n",
    "plt.plot(x, y, color='#36BD00')\n",
    " \n",
    "plt.title(\"$ Area $  $ chart $\" , fontsize = 16)\n",
    "plt.xlabel(\"$X$\" , fontsize = 16)\n",
    "plt.ylabel(\"$Y$\" , fontsize = 16)\n",
    "\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 338,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 52000 characters]\n",
      "text/plain": [
       "<Figure size 1152x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 46208 characters]\n",
      "text/plain": [
       "<Figure size 1152x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(1,51)\n",
    "y = np.random.normal(1,5,size=50)\n",
    "y = np.square(y)\n",
    "\n",
    "plt.figure(figsize=(16,6))\n",
    "plt.fill_between( x, y, color=\"#5ac8fa\", alpha=0.4)\n",
    "plt.plot(x, y, color=\"blue\", alpha=0.6) # Bold line on edges\n",
    "plt.title(\"$ Area $  $ chart $\" , fontsize = 16)\n",
    "plt.xlabel(\"$X$\" , fontsize = 16)\n",
    "plt.ylabel(\"$Y$\" , fontsize = 16)\n",
    "plt.show()\n",
    "\n",
    "plt.figure(figsize=(16,6))\n",
    "plt.fill_between( x, y, color=\"#5ac8fa\", alpha=0.4)\n",
    "plt.plot(x, y, color=\"blue\", alpha=0.2) # Less stronger line on edges\n",
    "plt.title(\"$ Area $  $ chart $\" , fontsize = 14)\n",
    "plt.xlabel(\"$X$\" , fontsize = 14)\n",
    "plt.ylabel(\"$Y$\" , fontsize = 14)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Stacked Area plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 339,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23824 characters]\n",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.arange(1,6)\n",
    "y1 =  np.array([1,5,9,13,17])\n",
    "y2 = np.array([2,6,10,14,16])\n",
    "y3 = np.array([3,7,11,15,19])\n",
    "y4 = np.array([4,8,12,16,20])\n",
    "\n",
    "plt.figure(figsize=(8,6))\n",
    "plt.stackplot(x,y1,y2,y3,y4, labels=['Y1','Y2','Y3','Y4'])\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 340,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23824 characters]\n",
      "text/plain": [
       "<Figure size 576x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.arange(1,6)\n",
    "y=[ [1,5,9,13,17], [2,6,10,14,16], [3,7,11,15,19] , [4,8,12,16,20] ]\n",
    "plt.figure(figsize=(8,6))\n",
    "plt.stackplot(x,y , labels=['Y1','Y2','Y3','Y4'])\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 341,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 38652 characters]\n",
      "text/plain": [
       "<Figure size 720x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.arange(1,7)\n",
    "y=[ [1,5,9,3,17,1], [2,6,10,4,16,2], [3,7,11,5,19,1] , [4,8,12,6,20,2] ]\n",
    "plt.figure(figsize=(10,6))\n",
    "plt.stackplot(x,y , labels=['Y1','Y2','Y3','Y4'])\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Changing Fill Color and its transperancy in Stacked Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 342,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 38628 characters]\n",
      "text/plain": [
       "<Figure size 792x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 37940 characters]\n",
      "text/plain": [
       "<Figure size 792x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 35980 characters]\n",
      "text/plain": [
       "<Figure size 792x432 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.arange(1,7)\n",
    "y=[ [1,5,9,3,17,1], [2,6,10,4,16,2], [3,7,11,5,19,1] , [4,8,12,6,20,2] ]\n",
    "\n",
    "plt.figure(figsize=(11,6))\n",
    "plt.stackplot(x,y , labels=['Y1','Y2','Y3','Y4'] , colors= [\"#00b159\" , \"#ffc425\", \"#f37735\", \"#ff3b30\"])\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()\n",
    "\n",
    "plt.figure(figsize=(11,6))\n",
    "plt.stackplot(x,y, labels=['Y1','Y2','Y3','Y4'], colors= [\"#00b159\" , \"#ffc425\", \"#f37735\", \"#ff3b30\"], alpha=0.7 )\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()\n",
    "\n",
    "plt.figure(figsize=(11,6))\n",
    "plt.stackplot(x,y, labels=['Y1','Y2','Y3','Y4'], colors= [\"#00b159\" , \"#ffc425\", \"#f37735\", \"#ff3b30\"], alpha=0.5 )\n",
    "plt.legend(loc='upper left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# END"
   ]
  }
 ],
 "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.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
