필터 지우기
필터 지우기

How to set Y and X labels for the correlation matrix

조회 수: 15 (최근 30일)
Abdulhakim Alezzi
Abdulhakim Alezzi 2020년 6월 16일
댓글: Abdulhakim Alezzi 2020년 6월 18일
Hi guys,
i have used this code to plot the correlatiom matrix for data 8X8 elements. i have succefully named the X axis, but failed to lable the y axis.
imagesc(X);
colormap(jet);
colorbar;
XlabelNames = {'F3','FZ','F4','CP5','CP6','P3','PZ','P4'};
YlabelNames = {'F3','FZ','F4','CP5','CP6','P3','PZ','P4'};
set(gca,'XTickLabel',XlabelNames); % gca gets the current axis
set(gca,'YTickLabel'YlabelNames); % gca gets the current axis
1- I want to lable the Y axis as well.
2-I want to plot all zero values with different color .
any help will be apperciated
  댓글 수: 2
KSSV
KSSV 2020년 6월 16일
Did you try ylabel ?
Abdulhakim Alezzi
Abdulhakim Alezzi 2020년 6월 16일
Yes, i did apply it and solve the problem 1 , i still want to plot all zero values with different color

댓글을 달려면 로그인하십시오.

채택된 답변

Utsav Agrawal
Utsav Agrawal 2020년 6월 18일
It is my understanding that you want to set X and Y label values for a correlation matrix and set a colour for all 0 values.
To set the X and Y labels, you can use the xticklabels and yticklabels functions respectively:
Try using the following code:
imagesc(X);
colormap(jet);
colorbar;
XlabelNames = {'F3','FZ','F4','CP5','CP6','P3','PZ','P4'};
YlabelNames = {'F3','FZ','F4','CP5','CP6','P3','PZ','P4'};
xticklabels(XlabelNames)
yticklabels(YlabelNames)
Assuming the minimum value in your matrix is 0 you can use caxis function to set the minimum colour limit to 0 as follows:
caxis([0 max]);
where max is the maximum value in your matrix.
For more information on caxis, you can refer here.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by