A heatmap can be used to visualize the correlation between variables.
The closer the correlation coefficient is to 1, the greener the squares appear. The closer it is to -1, the browner the squares become.
We can use the Seaborn library to generate a correlation heatmap, as it is a visualization library built on top of matplotlib.
import matplotlib.pyplot as plt import seaborn as sns correlation_full_health = full_health_data.corr() axis_corr = sns.heatmap( correlation_full_health, vmin=-1, vmax=1, center=0, cmap=sns.diverging_palette(50, 500, n=500), square=True ) plt.show() |
Example Explained: