matlab中的混淆矩阵图像

Confusion matrix image in matlab

我正在尝试为某些分类问题制作一个混淆矩阵。 到目前为止,我已经设法制作了一个 10 x 10 的矩阵来存储我对分类问题的估计的准确性。

现在我想制作一个 10 x 10 正方形图像(?),当矩阵该位置的数字较大时颜色较深。 (范围从 0 到 100)

我以前从未用 Matlab 做过图形。 任何帮助将不胜感激。

谢谢。

我会使用 image。例如:

img = 100*rand(4,4);  % Your image
img = img./100*64;  % The `image` function works on scale from 0->64
image(img); % or `image(img')` depending on how you want the axis
colormap('grey'); % For grey scale images
axis equal;       % For square pixels

或者对于反转颜色,您可以将一行更改为:

img = 64-img./100*64;