You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udemy-ML/04-Matplotlib/03-Matplotlib-Styling-Plots...

617 lines
257 KiB

2 years ago
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"___\n",
"\n",
"<a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>\n",
"___\n",
"# Matplotlib Styling"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Import the `matplotlib.pyplot` module under the name `plt` (the tidy way):"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# COMMON MISTAKE!\n",
"# DON'T FORGET THE .PYPLOT part\n",
"\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**NOTE: For users running .py scripts in an IDE like PyCharm or Sublime Text Editor. You will not see the plots in a notebook, instead if you are using another editor, you'll use: *plt.show()* at the end of all your plotting commands to have the figure pop up in another window.**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Data"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [],
"source": [
"x = np.arange(0,10)\n",
"y = 2 * x"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Legends"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can use the **label=\"label text\"** keyword argument when plots or other objects are added to the figure, and then using the **legend** method without arguments to add the legend to the figure: "
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x151b84e0c08>"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAdgAAAE/CAYAAADlmNKjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/A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fAM865w4FjgSWAtcBi5xzo4BF/j7AOcAo/2cmcHdUKxYRkcTz3lwoWwqn3wzJ4aCriYpOA9bMcoCTgD8COOfqnXPbgcnAHL/bHGCKvz0ZmOs8bwC5ZjYk6pWLiEhiqK2AF38Cw4+H0ecHXU3UdGUEewBQBvzJzN4zs3vNLBMY5JzbAOA/DvT7FwJr27y+1G9rx8xmmtliM1tcVlbWrS8hIiK92D/vgJ1lcNatYBZ0NVHTlYBNBo4C7nbOjQd20jod3JGOfjtutwbnZjvnSpxzJQUFBV0qVkREEsz2tfD6XXD4JVB4dNDVRFVXArYUKHXOvenvP4oXuJuap379x81t+g9r8/oiYH10yhURkYSyyF9MYuKNwdYRA50GrHNuI7DWzA7xmyYCHwPzgBl+2wzgKX97HjDdP5t4ArCjeSpZRESkxbp34MNH4LhZkDus8/69TFcX+/8G8BczCwOfAlfhhfMjZnY1sAZovt3BfOBcYCVQ7fcVERFp5Zx3r9fMAjjxO0FXExNdCljn3PtASQdPTeygrwN6351xRUSk5yx9Gta8DpNuh9TsoKuJCa3kJCIiPauxHhbcCAWjYfz0oKuJGd0PVkREetbbf4Btn8GVj0EocWNII1gREek51Vvh5Z/DgafBqNODriamFLAiItJzXvkF1FXAmbcGXUnMKWBFRKR
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure()\n",
"\n",
"ax = fig.add_axes([0,0,1,1])\n",
"\n",
"ax.plot(x, x**2, label=\"x**2\")\n",
"ax.plot(x, x**3, label=\"x**3\")\n",
"ax.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice how legend could potentially overlap some of the actual plot!\n",
"\n",
"The **legend** function takes an optional keyword argument **loc** that can be used to specify where in the figure the legend is to be drawn. The allowed values of **loc** are numerical codes for the various places the legend can be drawn. See the [documentation page](http://matplotlib.org/users/legend_guide.html#legend-location) for details. Some of the most common **loc** values are:"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAdgAAAE/CAYAAADlmNKjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXxU9b3/8dcnk0z2EEjClgBBRQVcQKPF5brhLgpacS1Qry3tLV1tb7VXa9V6W7tq/dVqqbWCbV3qipaqgHvrhstVESioLGENYUlC9sz398c52SCQQGZyJpP38/HIY875zndmPhORN9/vOed7zDmHiIiIRFdS0AWIiIgkIgWsiIhIDChgRUREYkABKyIiEgMKWBERkRhQwIqIiMRActAFAOTn57vi4uKgyxAREdkn77zzzhbnXEFHz8VFwBYXF7N48eKgyxAREdknZrZ6T89pilhERCQGFLAiIiIxoIAVERGJgbg4BtuRhoYGSktLqa2tDbqUmElLS6OoqIiUlJSgSxERkSiL24AtLS0lOzub4uJizCzocqLOOUd5eTmlpaWMHDky6HJERCTK4naKuLa2lry8vIQMVwAzIy8vL6FH6CIifVncBiyQsOHaLNG/n4hIXxbXARtvmu+de9NNN7Xsd9T2/vvvc9xxxzF27FiOOOIIHn744SDKFRGRAMXtMdh4dPvtt5OTk8POnTu5/vrrOfnkk/noo492aysuLmbu3LmMGjWK9evXc/TRR3PWWWeRm5sb9FcQEZEeohHsHrz99tscccQR1NbWsnPnTsaOHcuZZ57Jli1buPPOOzn77LM588wzueaaa3ZrO/jggxk1ahQAQ4cOZeDAgZSVlQX8jUREhMb6Hvsoa57iDFJJSYnbdanEpUuXMnr0aABufnoJH6+viOpnjhmaw4/OH7vXPjfccAO1tbXU1NRQVFREeno6WVlZLF++nHA4zCmnnMKSJUt2azvjjDNa3uOtt95ixowZLFmyhKSk3f890/Z7iohIDJW+Aw9/AS7/KwwdH5W3NLN3nHMlHT2nKeK9uP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IiMSP52+A1Bw46b+DrqTbFLAiIhIfViyET16Ak78PGQOCrqbbuhSwZpZrZo+a2TIzW2pmx5nZADNbYGYr/Mf+fl8zszvNbKWZfWBmR8X2K4iISK/X1OiNXgccAMd8OehqoqKrI9jfAM865w4FjgSWAtcBi5xzo4BF/j7AOcAo/2cmcHdUKxYRkcTz3lwoWwqn3wzJ4aCriYpOA9bMcoCTgD8COOfqnXPbgcnAHL/bHGCKvz0ZmOs8bwC5ZjYk6pWLiEhiqK2AF38Cw4+H0ecHXU3UdGUEewBQBvzJzN4zs3vNLBMY5JzbAOA/DvT7FwJr27y+1G9rx8xmmtliM1tcVlbWrS8hIiK92D/vgJ1lcNatYBZ0NVHTlYBNBo4C7nbOjQd20jod3JGOfjtutwbnZjvnSpxzJQUFBV0qVkREEsz2tfD6XXD4JVB4dNDVRFVXArYUKHXOvenvP4oXuJuap379x81t+g9r8/oiYH10yhURkYSyyF9MYuKNwdYRA50GrHNuI7DWzA7xmyYCHwPzgBl+2wzgKX97HjDdP5t4ArCjeSpZRESkxbp34MNH4LhZkDus8/69TFcX+/8G8BczCwOfAlfhhfMjZnY1sAZovt3BfOBcYCVQ7fcVERFp5Zx3r9fMAjjxO0FXExNdCljn3PtASQdPTeygrwN6351xRUSk5yx9Gta8DpNuh9TsoKuJCa3kJCIiPauxHhbcCAWjYfz0oKuJGd0PVkREetbbf4Btn8GVj0EocWNII1gREek51Vvh5Z/DgafBqNODriamFLAiItJzXvkF1FXAmbcGXUnMKWBFRKR
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Lots of options....\n",
"\n",
"ax.legend(loc=1) # upper right corner\n",
"ax.legend(loc=2) # upper left corner\n",
"ax.legend(loc=3) # lower left corner\n",
"ax.legend(loc=4) # lower right corner\n",
"\n",
"# .. many more options are available\n",
"\n",
"# Most common to choose\n",
"ax.legend(loc=0) # let matplotlib decide the optimal location\n",
"fig"
]
},
{
"cell_type": "code",
"execution_count": 86,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj0AAAE/CAYAAACtsXKXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXxU9b3/8ddnZrIvBJKwGJaogIBaBKN1u7WIOwpoxaWuVEu9VVtre2tbrVWvba23V21/em1xoWqt1mpVVNygamurVnABFRRUhLCGLQtZJ/P9/XFOyEIwCSQ5k5n38/HIY85850zyTh4Q3ny/ZzHnHCIiIiKJLhR0ABEREZHeoNIjIiIiSUGlR0RERJKCSo+IiIgkBZUeERERSQoqPSIiIpIUIkEHACgoKHDFxcVBxxAREemSRYsWbXLOFQadQzonLkpPcXExCxcuDDqGiIhIl5jZ50FnkM7T8paIiIgkBZUeERERSQoqPSIiIpIUVHpEREQkKaj0iIiISFJQ6REREZGkoNIjIiIiSUGlR0RERJKCSo+IiIgkBZUeERFJHtH6oBNIgFR6REQkOZQugt+Mh7XvBJ1EAqLSIyIiic85ePEaiEUhf2TQaSQgKj0iIpL4ls6FVa/DpJ9AWk7QaSQgKj0iIpLYovXw0s9g4DiYcH7QaSRAkaADiIiI9Ki37oatn8F5j0NY/+wlM830iIhI4qreAq/+CvadDCOPDTqNBEylR0REEtert0BdJRx/U9BJJA6o9IiISGLatMJb2pp4AQwaF3QaiQMdlh4z28/M3m3xUWFmV5rZADN7ycyW+4/9/f3NzH5rZivMbLGZTez5b0NERKSN+T+DSDpMuiboJBInOiw9zrmPnHMHOecOAg4GqoEngB8BC5xzo4AF/nOAk4BR/scs4K6eCC4iIrJLK1+DZc/AUd+D7IFBp5E40dXlrcnAJ865z4FpwP3++P3AdH97GvCA87wB5JnZkG5JKyIi0pFYDF64BnKHwuGXBZ1G4khXS8/ZwM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uBuDTiICqPSIiEhP2PAhvPMgHPJNyN836DQigEqPiIj0hBevhbQcOPqHQScR2UGlR0REutfy+fDJAjj6asgcEHQakR1UekREpPs0Rr1Znv57e0tbInFEp6yLiEj3eedBKFsKZz4AkdSg04i0opkeERHpHrUV3hlbww+HsVODTiOyE830iIhI9/jn7bC9DL7+ZzALOo3ITjTTIyIie27banj9TjhwBhQdHHQakXap9IiIyJ5b4F+AcPLPgs0h8gVUekREZM+sWQRLHoXDvg15w4JOI7JLKj0iIrL7nIMXroWsQjjqe0GnEflCKj0iIrL7lj4Nq/4Fk34C6blBpxH5Qio9IiKye+qq4KWfQuEYmHBB0GlEOqRT1kVEZPc8/yPY+jlc9AyE9c+JxL9OzfSY2UozW2Jm75rZQn9sgJm9ZGbL/cf+/riZ2W/NbIWZLTaziT35DYiISAA+eMK7+vJ/XAXFRwWdRqRTurK8Nck5d5BzrsR//iNggXNuFLDAfw5wEjDK/5gF3NVdYUVEJA5sWw1Pf9e7Hs9Xfxx0GpFO25NjeqYB9/vb9wPTW4w/4DxvAHlmNmQPvo6IiMSLWCP8dZb3+LV7IJwSdCKRTuts6XHAi2a2yMxm+WODnHPrAPzHgf54EbC6xXtL/bFWzGyWmS00s4VlZWW7l15ERHrXP271ztaa8r8wYJ+g04h0SWePPDvSObfWzAYCL5nZsi/Yt70brridBpybDcwGKCkp2el1ERGJM6v/Da/8Eg48E8afHXQakS7r1EyPc26t/7gReAI4FNjQtGzlP270dy8FWl6ScyiwtrsCi4hIAGrL4fGLod9QmPLroNOI7JYOS4+ZZZlZTtM2cDzwPjA
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"execution_count": 86,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ax.legend(loc=(1.1,0.5)) # manually set location\n",
"fig"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setting colors, linewidths, linetypes\n",
"\n",
"Matplotlib gives you *a lot* of options for customizing colors, linewidths, and linetypes. \n",
"\n",
"There is the basic MATLAB like syntax (which I would suggest you avoid using unless you already feel really comfortable with MATLAB). Instead let's focus on the keyword parameters.\n",
"\n",
"### Quick View:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Colors with MatLab like syntax"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With matplotlib, we can define the colors of lines and other graphical elements in a number of ways. First of all, we can use the MATLAB-like syntax where `'b'` means blue, `'g'` means green, etc. The MATLAB API for selecting line styles are also supported: where, for example, 'b.-' means a blue line with dots:"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x151b8c263c8>]"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXxU1f3/8dcn+wJhTVK2gAgEihXUqAiICiqiKFgqrkCtLbVfq+KOWn+tVlxaW7dalLrhUqHFBYoLq6ioKIuIC2ACKgSQnbCEBJI5vz/mRhIIJISZ3Mnk/fQxj3vvuXcyn5kHvnNy5swZc84hIiLRJcbvAkREJPQU7iIiUUjhLiIShRTuIiJRSOEuIhKF4vwuAKB58+auXbt2fpchIlKnLFy4cJNzLr2ycxER7u3atWPBggV+lyEiUqeY2fcHO6dhGRGRKKRwFxGJQgp3EZEopHAXEYlCCncRkSikcBcRiUIKdxGRKKRwFxHxQcAFKAmUhO3nK9xFRHwyL38eW3dvDcvPjohPqIqI1DcxFkPvrN7h+/lh+8kiIlKpv3/8d55a8FRYH0PhLiJSi77f9j13zr6T975/L6yPo3AXEalFt828DcN48MwHw/o4VYa7mWWb2eJyt+1mNsrMm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/G7nIijYRkRqZP+8ek/eGPZG/z97L/TNLmp3+VEHPXcRaTOWbRuETfPuJmBnQZG/dfl1ZTCXUTqlB3FO7hk0iWkp6Tz3KDnNM5+EBqWEZE6JTk+maFdh3L20WfTPKW53+VELIW7iNQZpYFS4mLiuLfvvX6XEvE0LCMidcLSjUv
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# MATLAB style line color and style \n",
"fig, ax = plt.subplots()\n",
"ax.plot(x, x**2, 'b.-') # blue line with dots\n",
"ax.plot(x, x**3, 'g--') # green dashed line"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Suggested Approach: Use keyword arguments\n",
"\n",
"### Colors with the color parameter"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also define colors by their names or RGB hex codes and optionally provide an alpha value using the `color` and `alpha` keyword arguments. Alpha indicates opacity."
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x151b8c7fa08>]"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3iW1d3A8e8Je+89EvZICCuETPYeAqJW7dK+b2nfLrWtLUuQTV3Vqh24J3W2aod1QvYkYYS9QgIBQoCE7HXeP85DBdRqSXLu505+n+viUiLw/JrC73q4c+77q7TWCCGEcB8fpwcQQghxfWSBCyGES8kCF0IIl5IFLoQQLiULXAghXKqxzRfr3Lmz9vPzs/mSQgjheqmpqee01l2u/bjVBe7n50dKSorNlx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QYXiszBwEUSsh07DrY5RerGU5Ac9QYVyE1QIWRlC6x6trc6Rn2++OJmeDk2bmlMlISHQzO4l/y8lC1wI4QkqbIXY+zxBhUnmSGDPEKtjVJR4ggqbTFBh6G1DiVgXYT2oUFwM0dGQlGSua4eEQGRk7d9JWVOywIVoyLSGo383j3c9txu6jobpfwLf6XbPcldWs+e5PcStiaPwZCH9ZvcjcqP9oEJZGSQkQFwclJfDqFEwaRK0a2d1jK9NFrgQDVV2jCeoEAvtB8K812DwTdaDCgffOkjMyhguHLxAz9CezH1lLn0m2g0qVFZCaqp5ZklREQwbBlOmQBe7X6v9r8kCF6Khyd1l3nEf/Tu06gHT/ggB37MfVPjIE1RIPUMn/04sfGchA+YPsHoTTnU17N4Nn34KFy9Cv37mJpzeva2NUCOywIV
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots()\n",
"\n",
"ax.plot(x, x+1, color=\"blue\", alpha=0.5) # half-transparant\n",
"ax.plot(x, x+2, color=\"#8B008B\") # RGB hex code\n",
"ax.plot(x, x+3, color=\"#FF8C00\") # RGB hex code "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Line and marker styles"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Linewidth\n",
"\n",
"To change the line width, we can use the `linewidth` or `lw` keyword argument. "
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x151b6dda608>]"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsEAAAFlCAYAAAAK1DURAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG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c633f3w1gDIAdqX5fERERqSd8H9i8GSgoYN/aoUPZ19dWhw+zrVlBAS8BDz1k73ns3cvAd8ECoGVLBr6bNxsx1S5d3SEeBJD9184QBwDck6bvKyIiImE5fBjYs4df9+sH9O8f7n7CVFICPPccsGsXA7y77+YYYxudPg0sXsxyhwMHgDlz+PLfwIFGZcHTEgT7vr8JwN+lmUVERMQwZ88C69cz+3vVVXb3862tBVavBt58ky92TZsGfP7zYe8qHNXVbO/musBrrwG33w788IfA+PHGTrXTxDgRERHb1dZycENFBes3R48GGjUKe1fh2bwZeOEFBn5jxwKPP27nefg+fy48j5nf3r2BaBT485/58p/hFASLiIjYyPeBbduAEyeAJk1Y53uBxbOu8vIY6J04wbKP73zH3vM4eJA1vp7HX0ejQE4O0KVLqNtKNwXBIiIiNsnLA7Zv59d9+gA33BDufsJUVsaM75YtQKdOwOzZwOWXh72rcBQXs67XdYGdO4GZMxkEDxliVJ3vZ6EgWEREpKErK+Nj7XicQZ7N/XxjMWDNGta1tmgBTJ4MzJsX9q7CUVMDrFjBYPfVV1n68c1
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"\n",
"# Use linewidth or lw\n",
"ax.plot(x, x-1, color=\"red\", linewidth=0.25)\n",
"ax.plot(x, x-2, color=\"red\", lw=0.50)\n",
"ax.plot(x, x-3, color=\"red\", lw=1)\n",
"ax.plot(x, x-4, color=\"red\", lw=10)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Linestyles\n",
"\n",
"There are many linestyles to choose from, here is the selection:"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x151b6df5d48>]"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsEAAAFlC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zJCssCx3LIzcwdlNG+A8Ua7CGaRJRUlNgFe9S01ODj6o/xUMxDtme+7r4YN2qc2q2qhoZgQgghhOhGa3crNlVsgiiJdqllVhF+EcjPzAdn5JA2Mk2DLtVjDfYoKC3AxeaLDmumRk0Fx3JDarPDQKAhmBBCCCFDmtlixv6q/RBMArac3uIwtczX3RcrUleAN/J4KPohuBhcNOhUHXcT7BEfGA/eyDtFsMft0BBMCCGEkCHJ1GCCYBJQVFZ0x9QynuWxNGXpoEwtGyh3G+yxJn0NeCPvVMEet0NDMCGEEEKGjMs3L6NQKoQoiShtLHVYw4aw4FhuSKSW3avSK6V4++jbXxvswbEcFiYu1HWwxzdFQzAhhBBCBrX2nna8d/o9iJKI/VX7YZEtdjWhvqHIy8xzurutXzZ8if8+/t92z50p2OPboiGYEEIIIYNOn6UPBy8ehCAJ2FSxyRbacCsvVy8sS10GnuUxK27WkEwtu1tNnU3YWrkVvJFXrDFbnrocT+98Gh29HYj2j7YFeyQHJWvY7dCg368WQgghhAw55Y3lECURBVIBLt28ZHfOgMGM2BngWA4rUldgmMcwDbpU11M7nsK7J99Fd183ov2jMSN2hu3M190Xb817C4kjEjE1aqqugz0GGg3BhBBCCNGUNbVMkAScqD/hsCY1KBW8kUdeZh4i/SNV7lBbrgZXW7KdKImKIRgAHhv7mBZtDXk0BBNCCCFEdZ29ndhWuQ2iJNpSy74qyDsIazPWgjfyGBs2VtfbDGpaalAgFeB6x3W8OfdNxRlv5PGno39CVlgWJkdM1qhD/aEhmBB
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# possible linestype options --, , -., :, steps\n",
"fig, ax = plt.subplots(figsize=(12,6))\n",
"\n",
"ax.plot(x, x-1, color=\"green\", lw=3, linestyle='-') # solid\n",
"ax.plot(x, x-2, color=\"green\", lw=3, ls='-.') # dash and dot\n",
"ax.plot(x, x-3, color=\"green\", lw=3, ls=':') # dots\n",
"ax.plot(x, x-4, color=\"green\", lw=3, ls='--') # dashes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Custom linestyle dash\n",
"\n",
"The dash sequence is a sequence of floats of even length describing\n",
"the length of dashes and spaces in points.\n",
"\n",
"For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point\n",
"dashes separated by 2 point spaces.\n",
"\n",
"First, we see we can actually \"grab\" the line from the .plot() command"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'list'>\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAFlCAYAAADvSvB9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXzU9YH/8fcnk/smhABJyM19HyKiXNFaDyyiWO9ubS1WgXav9rfd3W673Xbb7fbXXyXhLB71qD20rj1sa8sk3IdcCoqayX0AgYTc58x8fn9o++hW0aAZvpPJ6/kXyQzJ+wFfZl58883EWGsFAAAAhJIwpwcAAAAAg43IBQAAQMghcgEAABByiFwAAACEHCIXAAAAIYfIBQAAQMgJD8QHTU1NtTk5OYH40AAAAIAk6fDhw+estaPe67aARG5OTo4OHToUiA8NAAAASJKMMdUXuo3LFQAAABByiFwAAACEHCIXAAAAIYfIBQAAQMghcgEAABByiFwAAACEHCIXAAAAIYfIBQAAQMghcgEAABByiFwAAACEHCIXAAAAIYfIBQAAwIdirdVezznVt3Q7PeVdiFwAAABcFGutSt5s1KrN+3TXtgN6fE+l05PeJdzpAQAAABga/H6rP548o+ISj16ta1V6UrT+Y8VU3TZvnNPT3oXIBQAAwPvy+a1+e+KUit0evXG6XVkpsfrOLdN1y5xMRYYH54UBRC4AAADek9fn169ebVCx26Pys53KGxWn739ypj4x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zQjM9npacAHInIBAMD/0tjWox/uqtBT+2v
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"\n",
"lines = ax.plot(x,x)\n",
"\n",
"print(type(lines))"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAr8AAAFlCAYAAADiVIA6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXTU9b3/8dcnG0uEAhJQQGQpm4KlQC2oiFWkLnCLQhURrwKyyh6ICTP59ZybSSIQdpBFoKIiioS64QYVpUWqBjdQXKIIYkH2fQlJPr8/oN4rknwxJN/vZL7Pxz/K5M2Z17E5+GycTIy1VgAAAIAfRHk9AAAAAHAL8QsAAADfIH4BAADgG8QvAAAAfIP4BQAAgG8QvwAAAPCNGDefrGbNmrZBgwZuPiUAAAB8aMOGDXustQlnP+5q/DZo0EA5OTluPiUAAAB8yBiz9VyP87IHAAAA+AbxCwAAAN8gfgEAAOAbxC8AAAB8g/gFAACAbxC/AAAA8A3iFwAAAL5B/AIAAMA3iF8AAAD4BvELAAAA3yB+AQAA4BvELwAAAHyD+AUAAIBvEL8AAADwDeIXAAAAvkH8AgAAwDeIXwAAAPgG8QsAAADfIH4BAADgG8QvAAAAfIP4BQAAgG8QvwAAAPAN4hcAAMAn8vPztWTJEnXv3l0FBQVez/EE8QsAABDhTp06pUWLFqlFixbq06ePXnjhBS1fvtzrWZ4gfgEAACLUyZMnNXfuXDVp0kT9+/dXbm7ujx8LhUIqLCz0cJ03iF8AAIAIc+zYMU2fPl2NGjXSkCFDtHXr1p/dbNq0SS+88I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YAz4hcAABSroKBAy5cvV3p6ujZu3Oh4/+tf/1rjx49Xnz59FBsb68JC4PwRvwAA4Jzy8/P19NNPKyMjQ1988YXjfYsWLRQIBHT33XcrJobEQHjiMxMAAPxEXl6ennjiCWVmZuqbb75xvL/qqqsUDAbVo0cPRUVFubAQKDniFwAASJJOnDihhQsXasKECfruu+8c79u1a6fU1FR169ZNxhgXFgIXjvgFAMDnjh49qvnz52vSpEnasWOH4/21116r1NRUdenShehFuUP8AgDgU4cPH9bs2bM1ZcoU7d692/H+xhtvVDAY1A033ED0otwifgEA8Jn9+/dr5syZmjZtmvbv3+94f+uttyoYDOqaa65xYR1QtohfAAB8Ys+ePZo6dapmzZqlQ4cOOd53795dgUBA7dq1c2Ed4A7iFwCACLdz505lZWVpzpw5OnbsWLG3xhj9+c9/ViAQ0FVXXeXSQsA9xC8AABHq6NGjSklJ0WOPPaYTJ04UexsdHa3evXsrJSVFLVq0cGkh4D7iFwCACFWxYkWtWrWq2PCNiYnR/fffr5SUFDVu3NjFdYA3eCdqAAAiVHR0tAKBwDk/FhcXp6FDh+rrr7/WggULCF/4BvELAEAE69Wr10/CtlKlSho9erS2bNmi2bNnq379+h6uA9xH/AIAEMFiYmKUkpKiiy66SA8//LC+/fZbTZkyRXXq1PF6GuAJY6117cnatWtnc3JyXHs+AAAg5eXl6ciRI6pRo4bXUwDXGGM2WGt/9j59fOUXAIAIFxcXR/gCZxC/AAAA8A3iFwAAAL5B/AIAAMA3iF8AAAD4BvELAAAA3yB+AQAA4BvELwAAAHyD+AUAAIBvEL8AAADwDeIXAAAAvkH8AgAAwDeIXwAAAPgG8QsAAADfIH4BAADgG47xa4xZZIzZZYzZdI6PjTXGWGNMzbKZBwAAAJSe8/nK7+OSbjn7QWPMZZJulrStlDcBABB2cnNzZa31egaAC+QYv9batZL2neNDUyUlSeJPAgBAxPrggw90551
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"# custom dash\n",
"lines = ax.plot(x, x+8, color=\"black\", lw=5)\n",
"lines[0].set_dashes([10, 10]) # format: line length, space length"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAr8AAAFlCAYAAADiVIA6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de5iN9f7/8ddnTs5SOSRiKElK2aZEBxW6Ejr55lSSlJDTYDRj1vrVtWeZEWNQiS0JRVulYqfvrrR12G1hHIqSEsYh5w7OM2bm8/uDfPcYZjFm7nvN3M/HP1nv+6371bXXNq/rdq97GWutAAAAAC8IczsAAAAA4BTKLwAAADyD8gsAAADPoPwCAADAMyi/AAAA8AzKLwAAADwjwsmTVa1a1UZHRzt5SgAAAHjQihUr9lprq506d7T8RkdHKz093clTAgAAwIOMMRmnm3PbAwAAADyD8gsAAADPoPwCAADAMyi/AAAA8AzKLwAAADyD8gsAAADPoPwCAADAMyi/AAAA8AzKLwAAADyD8gsAAADPoPwCAADAMyi/AAAA8AzKLwAAADyD8gsAAIBztmHDBo0fP97tGOeM8gsAAICztm7dOvXo0UMNGzbU0KFDtXz5crcjnRPKLwAAAIL69ttv1blzZzVu3FhvvPGGcnNzJUmBQMDlZOeG8gsAAIAzSk9P1/3336/rrrtOb7/9tqy1eY4vWLBA33zzjUvpzh3lFwAAAPn85z//Ubt27XTDDTdo/vz5Be6mpaU5lOr8RbgdAAAAAKHBWqvPPvtMSUlJWrx4cdD9qlWratiwYerfv78D6YoG5RcAAMDjrLX6+OOPlZSUpK+++irofs2aNRUXF6c+ffqoQoUKDiQsOpRfAAAAj7LW6h//+IcCgcBZPbXhsssuU3x8vB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+++47jRo1SnPnzlVubm6Bu+XKldNTTz2luLg4XXrppQ4lhNdQfgEAQJFbtWqVRo0apXnz5gXdrVixovr376+hQ4eqRo0aDqSDl1F+AQBAkVm2bJmSkpL0wQcfBN294IILNGjQIA0ePFgXX3yxA+kAyi8AACgCX375pQKBgD7++OOguxdddJFiY2M1YMAAValSxYF0wP+h/AIAgEKx1upf//qXkpKS9Pnnnwfdr169uoYPH65+/fqpYsWKDiQE8qP8AgCAc2Kt1f/+7/8qEAhoyZIlQfcvvfRSjRgxQk8++aTKly/vQELgzCi/AADgrOTm5mrBggUKBAJasWJF0P26desqPj5evXr1UpkyZRxICARH+QUAAAXKycnRO++8o1GjRmnNmjVB96+44gqNHDlSjzzyiCIjIx1ICJw9yi8AADit7OxszZkzR8nJyVq/fn3Q/UaNGikxMVFdunRRRAQVA6GJdyYAAMgjKytLs2bNUkpKijZu3Bh0v0mTJvL5fOrUqZPCwsIcSAgUHuUXAABIko4ePapXX31Vzz//vLZu3Rp0PyYmRn6/Xx07dpQxxoGEwPmj/AIA4HGHDh3S1KlTNXbsWO3YsSPo/s033yy/36+77rqL0osSh/ILAIBHHThwQJMmTVJaWpr27NkTdP/OO++Uz+fT7bffTulFiUX5BQDAY3777Te9+OKLmjBhgn777beg++3atZPP51PLli0dSAcUL8ovAAAesXfvXo0fP14vvfSS9u/fH3T//vvvV2JiomJiYhxIBziD8gsAQCm3c+dOpaamavLkyTp8+HCBu8YYPfTQQ0pMTFSTJk0cSgg4h/ILAEApdejQISUkJOiVV17R0aNHC9wNDw9X9+7dlZCQoEaNGjmUEHAe5RcAgFKqbNmy+uSTTwosvhEREerZs6cSEhJ0+eWXO5gOcAd
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"# custom dash\n",
"lines = ax.plot(x, x+8, color=\"black\", lw=5)\n",
"lines[0].set_dashes([1, 1,1,1,10,10]) # format: line length, space length"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Markers\n",
"\n",
"We've technically always been plotting points, and matplotlib has been automatically drawing a line between these points for us. Let's explore how to place markers at each of these points.\n",
"\n",
"### Markers Style\n",
"\n",
"Huge list of marker types can be found here: https://matplotlib.org/3.2.2/api/markers_api.html"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x151b89eed08>]"
]
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAsEAAAFlCAYAAAAK1DURAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOzdeXyU53nv/88zI412DVqRNAJLgFiFQLK8YIPNYnaQkJzGTnPaJnaDS92EkM2Om8R2upyctseu+3v9jk/sxs3p7zSx4zBaAIPB2Dh4txghITaxSAaNNrSNds12//54cOLY2EjokUbSXO/XKy+MPM/9XFIM+uqe67kvTSmFEEIIIYQQwcQU6AKEEEIIIYQYbxKChRBCCCFE0JEQLIQQQgghgo6EYCGEEEIIEXQkBAshhBBCiKAjIVgIIYQQQgSdkEDcNDExUWVkZATi1kIIIYQQIogcO3asTSmV9OmPByQEZ2RkUFFREYhbCyGEEEKIIKJp2kfX+ri0QwghhBBCiKAjIVgIIYQQQgQdCcFCCCGEEGJMPX2oNtAlfIaEYCGEEEIIMaaeOXwu0CV8hoRgIYQQQggRdCQECyGEEEKIoCMhWAghhBBCBB0JwUIIIYQQIuhICBZCCCGEEEHHkBCsadouTdNOappWo2narzVNCzdiXSGEEEIIIcbCqEOwpmk24FtAvlIqGzAD9492XSGEEEIIIcaKUe0QIUCEpmkhQCTQaNC6QgghhBBi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Oev7p7NhsUpxIaHBrjCcXalVm91qP4NuC6DJQYWFuq7vjfdCaYg+kFgmCQECyGEEGJS8Pj8HD13hd0
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"\n",
"# Use marker for string code\n",
"# Use markersize or ms for size\n",
"\n",
"ax.plot(x, x-1,marker='+',markersize=20)\n",
"ax.plot(x, x-2,marker='o',ms=20) #ms can be used for markersize\n",
"ax.plot(x, x-3,marker='s',ms=20,lw=0) # make linewidth zero to see only markers\n",
"ax.plot(x, x-4,marker='1',ms=20)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Custom marker edges, thickness,size,and style"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAFlCAYAAADvSvB9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXSU5eH28esmYVEWEQVBUBHCYpDViAhqBAFBUBDFDVxqW21VsFYUsnCqnUnYkQBhE6SsgiKLKEgRKSqugMgWDMkgsilBkEWQkOR+/4C3pz8VMpNk5pl58v2cM+cIGSdXPdPwPcMz9xhrrQAAAAA3KeP0AAAAAKCkEbkAAABwHSIXAAAArkPkAgAAwHWIXAAAALgOkQsAAADXiQ7Gg1566aW2bt26wXhoAAAABMn69aH9ftddV7x/f/369QettdV/72tBidy6detq3bp1wXhoAAAABIkxof1+xc1FY8yuc32NyxUAAADgOkQuAAAAXIfIBQAAgOsQuQAAAHAdIhcAAACuQ+QCAADAdYJyhBgAAADcxyqwM8aMbJCWFI5XcgEAAOA6RC4AAABch8gFAACA6xC5AAAAcB0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zhwAJYC3dAIAAMB1iFwAAAC4jl+Ra4ypaoxZYIzZbozJMMZwkREAAADClr/X5KZJes9ae68xppykC4O4CQAAACiWQiPXGFNF0i2SHpMka22upNzgzgIAAACKzp/LFep
"text/plain": [
"<Figure size 864x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, ax = plt.subplots(figsize=(12,6))\n",
"\n",
"# marker size and color\n",
"ax.plot(x, x, color=\"black\", lw=1, ls='-', marker='s', markersize=20, \n",
" markerfacecolor=\"red\", markeredgewidth=8, markeredgecolor=\"blue\");"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Final Thoughts\n",
"\n",
"After these 4 notebooks on Matplotlib, you should feel comfortable creating simple quick plots, more advanced Figure plots and subplots, as well as styling them to your liking. You may have noticed we didn't cover statistical plots yet, like histograms or scatterplots, we will use the seaborn library to create those plots instead. Matplotlib is capable of creating those plots, but seaborn is easier to use (and built on top of matplotlib!).\n",
"\n",
"We have an additional notebook called \"Additional-Matplotlib-Commands\" which you can explore for other concepts, mainly as a quick reference. We also highly encourage you to always do a quick Google Search and StackOverflow search for matplotlib questions, as there are thousands of already answered questions there and almost any quick matplotlib question already has an answer there.\n",
"\n",
"----\n",
"----"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}