{
 "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 Matplotlib</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": [
    "# 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()"
   ]
  }
 ],
 "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
}
