How can the ConstantLine LineWidth property default be set?
2 次查看(过去 30 天)
显示 更早的评论
Using
set(groot,'defaultConstantLineLineWidth',2)
should set the ConstantLine's LineWidth default property to 2, but it gives the following error:
Error using matlab.ui.Root/set
constantlinelinewidth is an invalid class name
How can this default property be set?
This property would affect the vertical line drawn by xline(), for example:
x=[1:10];
y=x.^2;
plot(x,y);
xline(4);
I am following this resource
2 个评论
Adam Danz
2020-1-13
I'm guessing that your matlab release is prior to r2018b which is when the constantLine objects were released.
采纳的回答
Adam Danz
2020-1-13
编辑:Adam Danz
2020-1-13
After looking more closely as your code, I realized you're using a property that doesn't exist "defaultConstantLineLineWidth"; nor does "defaultConstantLineWidth".
3 个评论
Adam Danz
2020-1-13
编辑:Adam Danz
2020-1-13
That's correct, and an unfortunate inconsistancy. In fact, I'll report this to the tech team and suggest that it's changed in future releases.
Update: Case Number 03967262
To reproduce the inconsistancy, the code below sets the default line width to 6 and produces a line object and constantLine object, both of which have LineWidth properties, but only the line object is affected by the default setting.
set(groot,'defaultLineLineWidth',6)
cla()
plot([1 1],[0,1],'-')
h = xline(0.5);
xlim([0,1.5])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!