Here is the explanation of how it works:
- pd.read_csv() reads the winequality data, and wine_quality.corr() computes the correlation matrix.
- plt.imshow(corr, cmap='Blues') displays the correlation matrix as an image and applies one of the standard colormaps: Blues.
- plt.colorbar() displays the color scale indicating which color share represents which data range.
- plt.xticks() and plt.yticks() plot the tickers (one for each attribute in the dataset) and the corresponding ticker labels for the x and the y axis. Argument rotation=45 in plt.xticks() indicates that ticker lables should be placed at 45 degrees to the corresponding axis.
You should see the following heatmap. As expected, the data ranges from -0.6 to 1.0 (correlations ...