How to plot correlation coefficient matrix plot?
조회 수: 368 (최근 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;
참고 항목
카테고리
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!