我想在两个子情节点之间绘制一条线,但我不知道如何指向它们。 我有这个想法,但它引发了错误。
plot(subplot(1,2,1),[1 2],subplot(1,2,2),[3 4]);
答案 0 :(得分:0)
下面是使用 annotation()
函数绘制的一条线。此函数可以有多个输入属性,例如 arrow
或 line
,用于指示注释采用的形状。您可以通过调整下方的 X
和 Y
来编辑线的位置/坐标。
clf;
subplot(1,2,1); plot([1 2]);
subplot(1,2,2); plot([3 4]);
X = [0.465,0.57];
Y = [0.48,0.48];
Line_Annotation = annotation('line',X,Y);
Line_Annotation.LineWidth = 3;
Line_Annotation.Color = 'red';
clf;
subplot(1,2,1); plot([1 2]);
subplot(1,2,2); plot([3 4]);
X = [0.282,0.792];
Y = [0.48,0.65];
Line_Annotation = annotation('line',X,Y);
Line_Annotation.LineWidth = 1;
Line_Annotation.Color = 'red';
使用 MATLAB R2019b 运行