O'Reilly logo

Matplotlib 2.x By Example by Aldrin Yim, Claire Chung, Allen Yu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Categorical scatter plot

With the data classified into categories, we can check whether different population types exhibit different Big Mac index distributions.

We can use seaborn.lmplot to dissect the data and create a categorical scatter plot. As a recap, lmplot() combines regplot() with FacetGrid for visualization of three or more pairs of variables in faceted grids or color-coded scatter plots. In the upcoming examples, we are going to assign the population type variable to the col, row, or hue parameters of lmplot(). Let's see how the results look:

# Horizontal faceted grids (col="population type")g = sns.lmplot(x="Value", y="dollar_price", col="population type", data=merged_df2)g.set_xlabels("GDP per capita (constant 2000 US$)")g.set_ylabels("BigMac ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required