How can i rotate Confusion Matrix?
1 次查看(过去 30 天)
显示 更早的评论
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156652/image.png)
I need to rotate it to be like this.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156653/image.jpeg)
Any help. Plz.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!