How it works...

The following is the explanation for the code:

  • The wine_quality.corr() method returns a correlation matrix for all the attributes in the dataset.
  • The correlation values range from -1 (highly negative) to +1 (highly positive). Negative values are represented from red to black, and positive values are represented from dark yellow to white. Pure white is +1, which is the highest positive correlation, and pure black is the highest negative correlation.
  • As expected, all diagonal boxes are white, as they are a correlation with themselves, which has to be +1. The correlation between the pH and fixed acidity values is black, which means highly negative, close to -1

We get the output as follows: