How to do it...

The following is the code block that plots a heatmap of the correlation matrix:

  1. Read the data from a CSV file into a pandas DataFrame:
wine_quality = pd.read_csv('winequality.csv', delimiter=';')
  1. Get the correlation matrix of all attributes of wine_quality:
corr = wine_quality.corr()
  1. Specify the figure size:
plt.figure(figsize=(12,9))
  1. Plot the heatmap:
plt.imshow(corr,cmap='hot')
  1. Plot the colorbar to map which color represents which data values:
plt.colorbar()
  1. Label the x and y axis ticks. Show the x axis labels with 20 degrees of rotation:
plt.xticks(range(len(corr)),corr.columns, rotation=20)
plt.yticks(range(len(corr)),corr.columns)
  1. Display the plot on the screen:
plt.show()