Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MATLAB中是否有加粗图像的某些区域?_Matlab_Plot_Border - Fatal编程技术网

在MATLAB中是否有加粗图像的某些区域?

在MATLAB中是否有加粗图像的某些区域?,matlab,plot,border,Matlab,Plot,Border,以下矩阵源自imagesc(rand(10,10))作为纯示例 我想知道MATLAB中是否有一种方法可以为某些元素提供一个粗体的黑色边框?我在MS paint中做了一个糟糕的例子,只是为了让大家明白这一点 您只需使用绘图即可在任意位置绘制线条 imagesc(rand(10,10)), hold on plot([1.5,1.5],[0,10],'black','LineWidth',3) 然后以您想要的方式定义边界框。在我看来,另一种更好的方法是使用补丁,例如: imagesc(rand(1

以下矩阵源自imagesc(rand(10,10))作为纯示例


我想知道MATLAB中是否有一种方法可以为某些元素提供一个粗体的黑色边框?我在MS paint中做了一个糟糕的例子,只是为了让大家明白这一点

您只需使用
绘图
即可在任意位置绘制线条

imagesc(rand(10,10)), hold on
plot([1.5,1.5],[0,10],'black','LineWidth',3)

然后以您想要的方式定义边界框。

在我看来,另一种更好的方法是使用
补丁,例如:

imagesc(rand(10,10)), hold on
plot([1.5,1.5],[0,10],'black','LineWidth',3)
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添加到顶点坐标的原因是,在
imagesc
中,存储单元以整数值为中心,因此存储单元边缘位于0.5值上。

谢谢,非常容易实现。谢谢您的回答。我没想过要用“等一下”。