使用MATLAB R2018b,使用set(groot,'defaultConstantLineLineWidth',2)
应该将ConstantLine
的LineWidth
默认属性设置为2
,但它会给出以下错误:
Error using matlab.ui.Root/set
constantlinelinewidth is an invalid class name
如何设置此默认属性?
此属性会影响xline()
绘制的垂直线,例如:
x=[1:10];
y=x.^2;
plot(x,y);
xline(4);
我正在关注此资源
由于此版本的 MATLAB 中已知存在不一致,因此无法使用set(groot,'defaultConstantLineLineWidth',2)
在 MATLAB R2018b 中设置ConstantLine
的LineWidth
默认属性。请参阅讨论。
作为一个笨蛋,你可以做这样的事情:
x=[1:10];
y=x.^2;
plot(x,y);
hold on
plot(4*[1,1], [min(y), max(y)], 'LineWidth', 3)