How can i rotate Confusion Matrix?

조회 수: 2 (최근 30일)
Goma Najah
Goma Najah 2016년 9월 26일
댓글: George 2016년 9월 27일
I have this code for Confusion Matrix (CM),
C=confusionmat(labels,predicted);
L=length(unique(labels));
for i=1:L
Cmat(i,:)=C(i,:)./sum(C(i,:));
end
figure('visible','on');
imagesc(Cmat);colormap(flipud(summer));caxis([0,1])
textstr=num2str(Cmat(:),'%0.2f');
textstr=strtrim(cellstr(textstr));
[x,y]=meshgrid(1:L);
hstrg=text(x(:),y(:),textstr(:),'HorizontalAlignment','center','FontSize',16,'FontName','Times New Roman');
midvalue=mean(get(gca,'Clim'));
textColors=repmat(Cmat(:)>midvalue,1,3);
set(hstrg,{'color'},num2cell(textColors,2));
set(gca,'XTick',1:L,'XTickLabel',classes_names,'YTick',1:L,'YTickLabel',classes_names,'TickLength',[0,0],'FontSize',13,'FontName','Times New Roman');
colorbar;
DA=mean(diag(Cmat))*100;
This is original image:
I need to rotate it to be like this.
Any help. Plz.

답변 (1개)

George
George 2016년 9월 26일
ax = gca;
ax.XAxisLocation = 'top';
You can also do this with the set command, but I think the above is more clear.
  댓글 수: 2
Goma Najah
Goma Najah 2016년 9월 26일
Thanks, But i want the two axises start from same point.
0 1 2 3 4 5 6 7 8
--------------------------
0|
1|
2|
3|
4|
5|
6|
George
George 2016년 9월 27일
Can you post what it looks like after setting the XAxisLocation? It should just move the axis, not reorder it.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by