2013-11-24 764 views
1

我有一个混淆矩阵是这样的:图形绘制混淆矩阵在MATLAB

[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] 

其中行代表真理的地面,列表示分类结果。我想以图表的形式在网格中绘制它。我试过surface,但它只显示一个4x4的数字,而我的矩阵有5x5的大小。 我该怎么做?

回答

5

你希望你的困惑值来定义细胞值,而不是节点值(如surface一样)。

您可以使用imshow为您的目的,也可以结合一些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 

enter image description here

+0

这正是我要找的。谢谢你 –

+0

我该如何绘制盒子中的对角线值? –