How can I change the LineWidth according to several conditions?
3 次查看(过去 30 天)
显示 更早的评论
I am applying a compass plot and I would like the line's width changes according to certain conditions depending on one variable numress. I would like that if 0<numress<10 the LineWidth in plot plot is 0.5, if 10<numress<50 the LineWidth is 2. And so on
I tried this but does not work:
h=compass(u,v,'r')
if (0<=numress) & (numress<=10)
h.LineWidth=0.5
end
if (10<numress) & (numress<=50)
h.LineWidth=2
end
if (50<numress) & (numress<=100)
h.LineWidth=4
end
.
.
.
if (500<numress) & (numress<=550)
h.LineWidth=22
end
get(h,'LineWidth')
I tried with: get, set but the lines width do not change in my compass plotting. Can you please help me with this problem? Thank you
1 个评论
jonas
2018-4-25
set(h,'linewidth',10)
should change all the lines stored in the handle 'h'. If you want to change specific lines then you must specify those lines as h(1), h(2)... etc
采纳的回答
Image Analyst
2018-4-25
Often you pass in the line width. So compute it in advance, then pass it in when you call compass():
h=compass(u, v, 'r', 'LineWidth', lineWidth); % lineWidth value computed in advance.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!