4.4.4 Pairplot
Last updated
Last updated
A pair plot pairwise relationships in a dataset. The pair plot function creates a grid of Axes such that each variable in data will be shared in the y-axis across a single row and in the x-axis across a single column. The diagonal Axes are treated differently, drawing a plot to show the univariate distribution of the data for the variable in that column.
Let's draw a simple scatterplot for joint relationships and univariate distribution.
If you have a large dataset, you may consider a "small and specific" method to illustrate a subset of variables. Then we can use vars
. Compare to the whole dataset, below only shows the relationship between tip and table size.
Considering the simplicity, it's possible to remove the repetitive part and leave a lower triangle of bivariate axes.
If you want to represent an additional level of conditionalization. Then we can use the parameterhue
, which plots different subsets of data in different colors. Here is an example of showing different levels of a categorical variable by colors.
Also, we can use differentmarkers
for each level of the hue variable, to illustrate the difference.