Welcome to Make Charts with Seaborn! Seaborn is a Python data visualization library that is built on top of matplotlib. Matplotlib is Python’s foundational plotting library and is highly customizable. While matplotlib is a commonly used library, seaborn makes it easier for data scientists to create graphs with less required coding.
Seaborn has more built-in aesthetic themes and a more flexible and formulaic structure. You don’t have to be familiar with matplotlib to use seaborn, but it’s possible to use them in combination for more detailed customization when needed.
In this lesson we will…
- review the general structure of seaborn code
- learn how to make bar charts, scatter plots, and line graphs using seaborn
- explore three ways to visualize a distribution
In the Jupyter notebook to the right, we’ll start by comparing two plots: one made using matplotlib and the other using seaborn. These plots appear similar to one another but use different code and DataFrame formats.
Let’s look at the wide-format data that matplotlib uses. After running the first two code cells of the notebook, print the head of
Note: We’ve provided
%matplotlib inline for you in a separate cell at the start of the notebook. We need to run this code to render our plots within a Jupyter Notebook.
The wide-format data has a column for each of the five sets of plant heights. Run the provided code to see the plot produced by matplotlib.
Let’s look at the same data in long format, which is generally easier to use with seaborn. Print the head of
The long-format data stores all plant heights in one column and stores the set numbers in another column. Now let’s view the same plot created by seaborn using presets. Run the provided code to create the same plot with seaborn and