简体   繁体   中英

graphically plot confusion matrix in matlab

I have a confusion matrix like this:

[1   0   0   0   0 ]
[0  0.9  0  0.1  0 ]
[0   0   1   0   0 ]
[0   0   0   1   0 ]
[0.1 0  0.2  0  0.7]

where rows represent ground of truth, columns represent classification result. I would like to plot it graphically in a grid. I tried surface but it only shows a 4x4 figure whilst my matrix has 5x5 size. how can i do that?

You want your confusion values to define cell values instead of node values (as surface does).

You can use imshow for your purpose, maybe combined with some colormap .

A = [1   0   0   0   0 
     0  0.9  0  0.1  0 
     0   0   1   0   0 
     0   0   0   1   0 
     0.1 0  0.2  0  0.7 ]


imshow(A, 'InitialMagnification',10000)  % # you want your cells to be larger than single pixels
colormap(jet) % # to change the default grayscale colormap 

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM