{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f40a5154",
   "metadata": {
    "toc": true
   },
   "source": [
    "<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
    "<div class=\"toc\"><ul class=\"toc-item\"><li><span><a href=\"#Introduction\" data-toc-modified-id=\"Introduction-1\">Introduction</a></span></li><li><span><a href=\"#Initialization\" data-toc-modified-id=\"Initialization-2\">Initialization</a></span><ul class=\"toc-item\"><li><span><a href=\"#Imports\" data-toc-modified-id=\"Imports-2.1\">Imports</a></span></li></ul></li><li><span><a href=\"#Loading-Datasets\" data-toc-modified-id=\"Loading-Datasets-3\">Loading Datasets</a></span><ul class=\"toc-item\"><li><span><a href=\"#Iris\" data-toc-modified-id=\"Iris-3.1\">Iris</a></span></li><li><span><a href=\"#Wine-Reviews\" data-toc-modified-id=\"Wine-Reviews-3.2\">Wine Reviews</a></span></li></ul></li><li><span><a href=\"#Visualization\" data-toc-modified-id=\"Visualization-4\">Visualization</a></span><ul class=\"toc-item\"><li><span><a href=\"#Scatter-Plot\" data-toc-modified-id=\"Scatter-Plot-4.1\">Scatter Plot</a></span></li><li><span><a href=\"#Line-Chart\" data-toc-modified-id=\"Line-Chart-4.2\">Line Chart</a></span></li><li><span><a href=\"#Histogram\" data-toc-modified-id=\"Histogram-4.3\">Histogram</a></span></li><li><span><a href=\"#Bar-Chart\" data-toc-modified-id=\"Bar-Chart-4.4\">Bar Chart</a></span></li><li><span><a href=\"#Box-plots\" data-toc-modified-id=\"Box-plots-4.5\">Box plots</a></span></li><li><span><a href=\"#Heatmap\" data-toc-modified-id=\"Heatmap-4.6\">Heatmap</a></span></li></ul></li></ul></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ed2703e",
   "metadata": {},
   "source": [
    "# Introduction"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d58d95dc",
   "metadata": {},
   "source": [
    "Data visualization is the discipline of trying to understand data by placing it in a visual context so that patterns, trends and correlations that might not otherwise be detected can be exposed."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7aeaa2a5",
   "metadata": {},
   "source": [
    "# Initialization"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4a2d5f85",
   "metadata": {},
   "source": [
    "## Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "52e69565",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:02.935185Z",
     "start_time": "2021-08-12T09:07:02.052077Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from sklearn.datasets import load_iris"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "797de924",
   "metadata": {},
   "source": [
    "# Loading Datasets"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8cd7a031",
   "metadata": {},
   "source": [
    "## Iris"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "59573e5a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:02.939363Z",
     "start_time": "2021-08-12T09:07:02.936313Z"
    }
   },
   "outputs": [],
   "source": [
    "iris = load_iris()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3cfea362",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:02.948753Z",
     "start_time": "2021-08-12T09:07:02.940799Z"
    }
   },
   "outputs": [],
   "source": [
    "data = np.concatenate((iris.data, iris.target[:, np.newaxis]), axis=1)\n",
    "features = iris.feature_names + ['class']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ff271ef5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:02.966655Z",
     "start_time": "2021-08-12T09:07:02.949855Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal length (cm)</th>\n",
       "      <th>sepal width (cm)</th>\n",
       "      <th>petal length (cm)</th>\n",
       "      <th>petal width (cm)</th>\n",
       "      <th>class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>6.0</td>\n",
       "      <td>2.2</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.5</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>6.3</td>\n",
       "      <td>3.3</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.5</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>142</th>\n",
       "      <td>5.8</td>\n",
       "      <td>2.7</td>\n",
       "      <td>5.1</td>\n",
       "      <td>1.9</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>5.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.2</td>\n",
       "      <td>1.5</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>4.4</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     sepal length (cm)  sepal width (cm)  petal length (cm)  petal width (cm)  \\\n",
       "119                6.0               2.2                5.0               1.5   \n",
       "100                6.3               3.3                6.0               2.5   \n",
       "142                5.8               2.7                5.1               1.9   \n",
       "61                 5.9               3.0                4.2               1.5   \n",
       "42                 4.4               3.2                1.3               0.2   \n",
       "\n",
       "     class  \n",
       "119    2.0  \n",
       "100    2.0  \n",
       "142    2.0  \n",
       "61     1.0  \n",
       "42     0.0  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "iris_df = pd.DataFrame(data=data, columns=features)\n",
    "iris_df.sample(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf200cfc",
   "metadata": {},
   "source": [
    "## Wine Reviews"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e41fc202",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:03.627861Z",
     "start_time": "2021-08-12T09:07:02.967914Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>country</th>\n",
       "      <th>description</th>\n",
       "      <th>designation</th>\n",
       "      <th>points</th>\n",
       "      <th>price</th>\n",
       "      <th>province</th>\n",
       "      <th>region_1</th>\n",
       "      <th>region_2</th>\n",
       "      <th>taster_name</th>\n",
       "      <th>taster_twitter_handle</th>\n",
       "      <th>title</th>\n",
       "      <th>variety</th>\n",
       "      <th>winery</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>10801</th>\n",
       "      <td>Chile</td>\n",
       "      <td>Tropical fruit and hay aromas open this plump ...</td>\n",
       "      <td>Wave Series Left Wave</td>\n",
       "      <td>85</td>\n",
       "      <td>10.0</td>\n",
       "      <td>Leyda Valley</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Michael Schachner</td>\n",
       "      <td>@wineschach</td>\n",
       "      <td>Carmen 2016 Wave Series Left Wave Sauvignon Bl...</td>\n",
       "      <td>Sauvignon Blanc</td>\n",
       "      <td>Carmen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115035</th>\n",
       "      <td>US</td>\n",
       "      <td>Comprised of 48% Cabernet Sauvignon, 47% Merlo...</td>\n",
       "      <td>Estate</td>\n",
       "      <td>87</td>\n",
       "      <td>34.0</td>\n",
       "      <td>California</td>\n",
       "      <td>Santa Clara Valley</td>\n",
       "      <td>Central Coast</td>\n",
       "      <td>Virginie Boone</td>\n",
       "      <td>@vboone</td>\n",
       "      <td>Jason-Stephens 2007 Estate Meritage (Santa Cla...</td>\n",
       "      <td>Meritage</td>\n",
       "      <td>Jason-Stephens</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22780</th>\n",
       "      <td>Germany</td>\n",
       "      <td>Layers of luscious mango, tangerine and pineap...</td>\n",
       "      <td>Rhein</td>\n",
       "      <td>90</td>\n",
       "      <td>12.0</td>\n",
       "      <td>Rheinhessen</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Anna Lee C. Iijima</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Leonard Kreusch 2013 Rhein Riesling (Rheinhessen)</td>\n",
       "      <td>Riesling</td>\n",
       "      <td>Leonard Kreusch</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70914</th>\n",
       "      <td>Australia</td>\n",
       "      <td>The 2008 Phoenix Cabernet displays amply conce...</td>\n",
       "      <td>Phoenix</td>\n",
       "      <td>89</td>\n",
       "      <td>20.0</td>\n",
       "      <td>South Australia</td>\n",
       "      <td>Coonawarra</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Joe Czerwinski</td>\n",
       "      <td>@JoeCz</td>\n",
       "      <td>Penley Estate 2008 Phoenix Cabernet Sauvignon ...</td>\n",
       "      <td>Cabernet Sauvignon</td>\n",
       "      <td>Penley Estate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74396</th>\n",
       "      <td>US</td>\n",
       "      <td>This Pinot does not shy away from some sharp, ...</td>\n",
       "      <td>Five Blocks Wren and Temperance Hill</td>\n",
       "      <td>88</td>\n",
       "      <td>25.0</td>\n",
       "      <td>Oregon</td>\n",
       "      <td>Willamette Valley</td>\n",
       "      <td>Willamette Valley</td>\n",
       "      <td>Paul Gregutt</td>\n",
       "      <td>@paulgwine</td>\n",
       "      <td>Lumos 2013 Five Blocks Wren and Temperance Hil...</td>\n",
       "      <td>Pinot Noir</td>\n",
       "      <td>Lumos</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          country                                        description  \\\n",
       "10801       Chile  Tropical fruit and hay aromas open this plump ...   \n",
       "115035         US  Comprised of 48% Cabernet Sauvignon, 47% Merlo...   \n",
       "22780     Germany  Layers of luscious mango, tangerine and pineap...   \n",
       "70914   Australia  The 2008 Phoenix Cabernet displays amply conce...   \n",
       "74396          US  This Pinot does not shy away from some sharp, ...   \n",
       "\n",
       "                                 designation  points  price         province  \\\n",
       "10801                  Wave Series Left Wave      85   10.0     Leyda Valley   \n",
       "115035                                Estate      87   34.0       California   \n",
       "22780                                  Rhein      90   12.0      Rheinhessen   \n",
       "70914                                Phoenix      89   20.0  South Australia   \n",
       "74396   Five Blocks Wren and Temperance Hill      88   25.0           Oregon   \n",
       "\n",
       "                  region_1           region_2         taster_name  \\\n",
       "10801                  NaN                NaN   Michael Schachner   \n",
       "115035  Santa Clara Valley      Central Coast      Virginie Boone   \n",
       "22780                  NaN                NaN  Anna Lee C. Iijima   \n",
       "70914           Coonawarra                NaN      Joe Czerwinski   \n",
       "74396    Willamette Valley  Willamette Valley        Paul Gregutt   \n",
       "\n",
       "       taster_twitter_handle  \\\n",
       "10801            @wineschach   \n",
       "115035               @vboone   \n",
       "22780                    NaN   \n",
       "70914                 @JoeCz   \n",
       "74396            @paulgwine    \n",
       "\n",
       "                                                    title             variety  \\\n",
       "10801   Carmen 2016 Wave Series Left Wave Sauvignon Bl...     Sauvignon Blanc   \n",
       "115035  Jason-Stephens 2007 Estate Meritage (Santa Cla...            Meritage   \n",
       "22780   Leonard Kreusch 2013 Rhein Riesling (Rheinhessen)            Riesling   \n",
       "70914   Penley Estate 2008 Phoenix Cabernet Sauvignon ...  Cabernet Sauvignon   \n",
       "74396   Lumos 2013 Five Blocks Wren and Temperance Hil...          Pinot Noir   \n",
       "\n",
       "                 winery  \n",
       "10801            Carmen  \n",
       "115035   Jason-Stephens  \n",
       "22780   Leonard Kreusch  \n",
       "70914     Penley Estate  \n",
       "74396             Lumos  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wine_reviews_df = pd.read_csv('winemag-data-130k-v2.csv', index_col=0)\n",
    "wine_reviews_df.sample(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "91f0b755",
   "metadata": {},
   "source": [
    "# Visualization"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c43f8e07",
   "metadata": {},
   "source": [
    "## Scatter Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "254fa46f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:03.732857Z",
     "start_time": "2021-08-12T09:07:03.629024Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 26880 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(iris_df['sepal length (cm)'], iris_df['sepal width (cm)'])\n",
    "\n",
    "plt.title('Iris Dataset')\n",
    "plt.xlabel('sepal length (cm)')\n",
    "plt.ylabel('sepal width (cm)')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "0138cb47",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:03.826792Z",
     "start_time": "2021-08-12T09:07:03.733837Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 26880 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# create a figure and axis\n",
    "fig, ax = plt.subplots()\n",
    "\n",
    "# scatter the sepal_length against the sepal_width\n",
    "ax.scatter(iris_df['sepal length (cm)'], iris_df['sepal width (cm)'])\n",
    "\n",
    "# set a title and labels\n",
    "ax.set_title('Iris Dataset')\n",
    "ax.set_xlabel('sepal length (cm)')\n",
    "ax.set_ylabel('sepal width (cm)')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ffe18980",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:03.925737Z",
     "start_time": "2021-08-12T09:07:03.828511Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25668 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "iris_df.plot.scatter(x='sepal length (cm)', \n",
    "                     y='sepal width (cm)', \n",
    "                     title= 'Iris Dataset')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "8dd72435",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.109980Z",
     "start_time": "2021-08-12T09:07:03.927130Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 45468 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.scatterplot(x='sepal length (cm)',\n",
    "                y='sepal width (cm)',\n",
    "                data=iris_df, hue='class', palette=['r', 'g', 'b'])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cdaca3d7",
   "metadata": {},
   "source": [
    "## Line Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "e8c94af0",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.239936Z",
     "start_time": "2021-08-12T09:07:04.111087Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 112780 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "columns = iris_df.columns.drop(['class'])\n",
    "\n",
    "x_data = range(0, iris_df.shape[0])\n",
    "\n",
    "fig, ax = plt.subplots()\n",
    "for column in columns:\n",
    "    ax.plot(x_data, iris_df[column], label=column)\n",
    "    \n",
    "ax.set_title('Iris Dataset')\n",
    "ax.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "4410f6ad",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.369659Z",
     "start_time": "2021-08-12T09:07:04.240973Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 112780 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "iris_df.drop(['class'], axis=1).plot.line(title='Iris Dataset')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "9f1e9124",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.547054Z",
     "start_time": "2021-08-12T09:07:04.370677Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 132524 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.lineplot(data=iris_df.drop(['class'], axis=1))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e620be6",
   "metadata": {},
   "source": [
    "## Histogram"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "f4b9c2ca",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.649517Z",
     "start_time": "2021-08-12T09:07:04.548007Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 24600 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots()\n",
    "ax.hist(wine_reviews_df['points'])\n",
    "ax.set_title('Wine Review Scores')\n",
    "ax.set_xlabel('Points')\n",
    "ax.set_ylabel('Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "51f9a228",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:04.755150Z",
     "start_time": "2021-08-12T09:07:04.650521Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18504 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wine_reviews_df['points'].plot.hist()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "dcb4a5b1",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:05.160553Z",
     "start_time": "2021-08-12T09:07:04.756074Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 41692 characters]\n",
      "text/plain": [
       "<Figure size 1000x1000 with 4 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "iris_df.drop('class', axis=1).plot.hist(subplots=True, layout=(2,2), figsize=(10, 10), bins=20)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "4836766a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:05.435848Z",
     "start_time": "2021-08-12T09:07:05.161690Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 19452 characters]\n",
      "text/plain": [
       "<Figure size 500x500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.displot(wine_reviews_df['points'], bins=10, kde=False)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "dea951ba",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.140406Z",
     "start_time": "2021-08-12T09:07:05.436947Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 45060 characters]\n",
      "text/plain": [
       "<Figure size 500x500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.displot(wine_reviews_df['points'], bins=10, kde=True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "17426ed9",
   "metadata": {},
   "source": [
    "## Bar Chart"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "f213682e",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.301804Z",
     "start_time": "2021-08-12T09:07:06.141456Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23724 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots() \n",
    "data = wine_reviews_df['points'].value_counts() \n",
    "points = data.index \n",
    "frequency = data.values \n",
    "ax.bar(points, frequency) \n",
    "ax.set_title('Wine Review Scores') \n",
    "ax.set_xlabel('Points') \n",
    "ax.set_ylabel('Frequency')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "79e33fa7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.452403Z",
     "start_time": "2021-08-12T09:07:06.302824Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 18068 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wine_reviews_df['points'].value_counts().sort_index().plot.bar()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "7f497f83",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.613119Z",
     "start_time": "2021-08-12T09:07:06.453428Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 23240 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wine_reviews_df['points'].value_counts().sort_index().plot.barh()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "fde3988c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.713791Z",
     "start_time": "2021-08-12T09:07:06.614017Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 19696 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wine_reviews_df.groupby(\"country\").price.mean().sort_values(ascending=False)[:5].plot.bar()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "6e63f909",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:06.883900Z",
     "start_time": "2021-08-12T09:07:06.714946Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 20772 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.countplot(x='points', data=wine_reviews_df)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5a01641f",
   "metadata": {},
   "source": [
    "## Box plots"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "9fc2fd5f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:07.016041Z",
     "start_time": "2021-08-12T09:07:06.887497Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25292 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df = wine_reviews_df[(wine_reviews_df['points']>=95) & (wine_reviews_df['price']<1000)]\n",
    "sns.boxplot(x='points', y='price', data=df)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a65bd7f0",
   "metadata": {},
   "source": [
    "## Heatmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "2fdee995",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:07.199107Z",
     "start_time": "2021-08-12T09:07:07.017657Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 46804 characters]\n",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(iris_df.drop(['class'], axis=1).corr(), annot=True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "018c1dbe",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-12T09:07:08.889632Z",
     "start_time": "2021-08-12T09:07:07.200555Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 147968 characters]\n",
      "text/plain": [
       "<Figure size 1000x1000 with 20 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.pairplot(iris_df.drop(['class'], axis=1))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e3ea8a83",
   "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.8.11"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": true,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
