{ "cells": [ { "cell_type": "markdown", "id": "3b84ddbc-2079-48c9-a38b-b0a34abd6d27", "metadata": {}, "source": [ "# Introduction to Seaborn" ] }, { "cell_type": "markdown", "id": "bbbcdd64-9f9f-4114-9359-20b24436dd62", "metadata": {}, "source": [ "[Seaborn](https://seaborn.pydata.org/) is a library for making statistical graphics in Python. It builds on top of [matplotlib](https://matplotlib.org/) and integrates closely with [pandas](https://pandas.pydata.org/) data structures." ] }, { "cell_type": "code", "execution_count": 1, "id": "ec137599-b8bd-4666-b5f7-13e94243b50e", "metadata": {}, "outputs": [], "source": [ "import seaborn as sns\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "1e2c1579-8df5-4e70-bd10-8a6095f2d564", "metadata": {}, "source": [ "## Scatter plots with seaborn" ] }, { "cell_type": "markdown", "id": "88932903-b980-42a3-b6e8-3f42327735c6", "metadata": {}, "source": [ "We start by loading a table of measurements into a dataframe `df`." ] }, { "cell_type": "code", "execution_count": 2, "id": "c0a502d8-9181-47b4-8e6b-63b37ed3a8d4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | area | \n", "intensity_mean | \n", "major_axis_length | \n", "minor_axis_length | \n", "aspect_ratio | \n", "file_name | \n", "
---|---|---|---|---|---|---|
0 | \n", "139 | \n", "96.546763 | \n", "17.504104 | \n", "10.292770 | \n", "1.700621 | \n", "20P1_POS0010_D_1UL | \n", "
1 | \n", "360 | \n", "86.613889 | \n", "35.746808 | \n", "14.983124 | \n", "2.385805 | \n", "20P1_POS0010_D_1UL | \n", "
2 | \n", "43 | \n", "91.488372 | \n", "12.967884 | \n", "4.351573 | \n", "2.980045 | \n", "20P1_POS0010_D_1UL | \n", "
3 | \n", "140 | \n", "73.742857 | \n", "18.940508 | \n", "10.314404 | \n", "1.836316 | \n", "20P1_POS0010_D_1UL | \n", "
4 | \n", "144 | \n", "89.375000 | \n", "13.639308 | \n", "13.458532 | \n", "1.013432 | \n", "20P1_POS0010_D_1UL | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
106 | \n", "305 | \n", "88.252459 | \n", "20.226532 | \n", "19.244210 | \n", "1.051045 | \n", "20P1_POS0007_D_1UL | \n", "
107 | \n", "593 | \n", "89.905565 | \n", "36.508370 | \n", "21.365394 | \n", "1.708762 | \n", "20P1_POS0007_D_1UL | \n", "
108 | \n", "289 | \n", "106.851211 | \n", "20.427809 | \n", "18.221452 | \n", "1.121086 | \n", "20P1_POS0007_D_1UL | \n", "
109 | \n", "277 | \n", "100.664260 | \n", "20.307965 | \n", "17.432920 | \n", "1.164920 | \n", "20P1_POS0007_D_1UL | \n", "
110 | \n", "46 | \n", "70.869565 | \n", "11.648895 | \n", "5.298003 | \n", "2.198733 | \n", "20P1_POS0007_D_1UL | \n", "
111 rows × 6 columns
\n", "