Axis Grids
Let’s learn how to draw multiple instances of the same plot on different subsets of the dataset.
We'll cover the following
When exploring a medium-sized dataset, it’s helpful to draw multiple instances of the same plot on different subsets of our dataset. Grid plots (also called panel, lattice, or trellis plots) allow us to quickly extract a significant amount of information about our complex data in a series of similar graphs using the same scale and axes. This allows easy comparisons and provides a brief overview of the data under analysis.
Matplotlib offers good support for making figures with multiple axes. Seaborn builds on top of this to directly link the structure of the plot to the design of our dataset.
Let’s learn with some examples using the datasets tips
and iris
. We’ve already used tips
in the previous lessons. The iris
data set is a famous dataset that includes three species of the iris, with 50 samples of each as well as some properties about each flower. This dataset is a part of the seaborn library and is also available on Kaggle.
To use the axis grids features, your data has to be in a pandas DataFrame, and it must take the form of what Hadley Whickam calls “tidy” data. In brief, this means your DataFrame should be structured such that each column is a variable and each row is an observation.
Get hands-on with 1400+ tech skills courses.