有没有办法在 MATLAB 中将 imagesc 的某些区域加粗?

2023-12-19

The following matrix was derived from imagesc(rand(10,10)) as a pure example. enter image description here

I was wondering if there was a way in MATLAB to give a bold black border to certain elements? I did a poor example in MS paint just to get the point across. enter image description here


我认为更好的替代方法是使用patch, 例如:

imagesc(rand(10,10)), hold on

vert = 0.5+[0 0; 1 0; 1 1; 0 1]; % x and y vertex coordinates
fac = [1 2 3 4];              % vertices to connect to make square

patch('Faces',fac,'Vertices',vert,'FaceColor','none','LineWidth',2)

vert2 = 0.5+[5 6; 5 8; 9 8; 9 5; 7 5; 7 6]; % x and y vertex coordinates
fac2 = [1 2 3 4 5 6 ];  % vertices to connect to make the other closed polygon

patch('Faces',fac2,'Vertices',vert2,'FaceColor','none','LineWidth',2)

请注意,我向顶点坐标添加 0.5 的原因是因为imagescbin 以整数值为中心,因此 bin 边缘位于 0.5 值上。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

有没有办法在 MATLAB 中将 imagesc 的某些区域加粗? 的相关文章

随机推荐