how to make a pairs plot with pandas

import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

from sklearn import datasets

iris_dataset = datasets.load_iris()
X = iris_dataset.data
Y = iris_dataset.target

iris_dataframe = pd.DataFrame(X, columns=iris_dataset.feature_names)

# Create a scatter matrix from the dataframe, color by y_train
grr = pd.plotting.scatter_matrix(iris_dataframe, c=Y, figsize=(15, 15), marker='o',
                                 hist_kwds={'bins': 20}, s=60, alpha=.8)

Here is what the above code is Doing:
1. Load the Iris dataset.
2. Create a DataFrame from the Iris data.
3. Plot all the possible scatter plots for the features in the dataset.
4. Color the scatter plots by the target class.
5. Label the axes of the scatter plots.
6. Display a legend for the class labels.
7. Display a plot.

The result is a grid of scatter plots showing all the possible pairwise relationships between the features.

The diagonal (upper left, lower right) shows the distribution of the data for each feature.

The off-diagonal elements show the relationship (or lack thereof) between two features.

For example, the plot in the upper right shows the relationship between petal length and petal width.

The points are colored by species, so you can see that Iris-setosa is clearly separable from the other two species.

The other two plots are not as easy to interpret.

We can also plot all these pairwise relationships in 3D using the plot_trisurf() function.

This creates a 3D surface plot where the points are colored according to the class.