Now let's look at how we can use the PairGrid method to draw grid-aware plots. We are using the MLB players dataset for this, as shown in the following code:
mlb = pd.read_csv('data-mlb-players.csv')mlb.head()
The output is as follows:
Let's create a plot with the following code:
g = sns.PairGrid(mlb, vars=["Height", "Weight"], hue="Position")g.map(plt.scatter);g.add_legend();
Here, we have passed our dataset of MLB players, and we set vars to a list containing players' Height and Weight. We then set hue as Position. We then ...