July 2019
Beginner to intermediate
740 pages
16h 52m
English
Faceting allows us to plot subsets (facets) of our data across subplots. We already saw a few as a result of some seaborn functions; however, we can easily make them for ourselves with any function. Let's create a facet grid that will allow us to compare the distributions of earthquake magnitudes across the magTypes of ml and md in California, Alaska, and Hawaii.
First, we create the FacetGrid object with the data we will be using and define how it will be subset with the row and col arguments:
>>> g = sns.FacetGrid(... quakes[... (quakes.parsed_place.isin([... 'California', 'Alaska', 'Hawaii'... ]))\... & (quakes.magType.isin(['ml', 'md']))... ], ... row='magType', ... col='parsed_place'... )
Then, we use the FacetGrid.map() ...
Read now
Unlock full access