How to plot correlation coefficient matrix plot?
8 views (last 30 days)
Adam Danz on 29 Jun 2022
Edited: Adam Danz on 29 Jun 2022
Assuming you already have the correlation matrix, use heatmap. The upper triangle can be filled with NaNs.
S = load('Data_Canada');
r = corr(S.Data)
% Replace upper triangle with NaNs
isupper = logical(triu(ones(size(r)),1));
r(isupper) = NaN
% Plot results
h = heatmap(r,'MissingDataColor','w');
labels = ["wt","hp","xy","ad","tt"];
h.XDisplayLabels = labels;
h.YDisplayLabels = labels;