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 ...

Get Numerical Computing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.