How to plot correlation coefficient matrix plot?
388 ビュー (過去 30 日間)
古いコメントを表示
I want to plot a correlation coefficient matrix plot and I want to show the values at each individual box as shown in the picture. I have my my calculated correlation coeff values.
0 件のコメント
回答 (1 件)
Adam Danz
2022 年 6 月 29 日
編集済み: Adam Danz
2022 年 6 月 29 日
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;
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!