I have the following code to generate 3 PairPlots
, each one with a single ax:
sns.pairplot(df, x_vars="Agricultural area", y_vars="Wooded area", hue="Elevation")
sns.pairplot(df, x_vars="Agricultural area", y_vars="Settlement area", hue="Elevation")
sns.pairplot(df, x_vars="Agricultural area", y_vars="Unproductive area", hue="Elevation")
plt.show()
This works, but it generates 3 distinct figures. I now would like to have the result in the same figure, for example using this:
fig, axes = plt.subplots(1, 3, sharey=True, figsize=(15, 10))
Then adding PairGrid[0],[0]
to the first ax (axes[0]
) and so on. There is no ax
parameter in pairplot
which I guess is normal as it returns a grid, not an ax. Is this possible (how)? Else is there a better solution to achieve this?