CommencerCommencer gratuitement

Additional pairplots

This exercise will go through a couple of more examples of how the pairplot() can be customized for quickly analyzing data and determining areas of interest that might be worthy of additional analysis.

One area of customization that is useful is to explicitly define the x_vars and y_vars that you wish to examine. Instead of examining all pairwise relationships, this capability allows you to look only at the specific interactions that may be of interest.

We have already looked at using kind to control the types of plots. We can also use diag_kind to control the types of plots shown on the diagonals. In the final example, we will include a regression and kde plot in the pairplot.

Cet exercice fait partie du cours

Intermediate Data Visualization with Seaborn

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Build a pairplot with different x and y variables
sns.___(data=df,
        ___=["fatal_collisions_speeding", "fatal_collisions_alc"],
        ___=['premiums', 'insurance_losses'],
        kind='scatter',
        hue='Region',
        ___='husl')

plt.show()
plt.clf()
Modifier et exécuter le code