A pairplot is used to see the pairwise relationship between every pair of attributes in a dataset. For example, let’s say we are reading the iris dataset. The dataset contains various information such as sepal length, sepal width, petal length, and petal width of a flower. And based on these attributes one can determine the type of flower.
We can use the following Python code to read the iris dataset from the seaborn library and plot a pairplot between every two variables in the dataset.
import seaborn from matplotlib import pyplot df = seaborn.load_dataset("iris") seaborn.pairplot(data=df, kind="scatter") pyplot.savefig("seaborn-pairplot-scatter.png") pyplot.close()
Please note that here we are using scatter as the underlying plotting function. The resulting pair plot will look like the following:
We can also use kde as the underlying function. If we do so, we will get KDE plots or Kernel Density Estimate plots for every …






0 Comments