gpt4 book ai didi

matlab - 无论如何在 MATLAB 中加粗 imagesc 的某些区域?

转载 作者:太空宇宙 更新时间:2023-11-03 19:54:58 31 4
gpt4 key购买 nike

下面的矩阵是从 imagesc(rand(10,10)) 派生的,作为一个纯粹的例子。 enter image description here

我想知道在 MATLAB 中是否有办法为某些元素提供粗体黑色边框?我在 MS paint 中做了一个糟糕的例子只是为了说明这一点。 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)

enter image description here

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

关于matlab - 无论如何在 MATLAB 中加粗 imagesc 的某些区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31595856/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com