Plot one line with different linewidth according to a third array
이전 댓글 표시
I would like to have a plot in which parts of the line will be of different LineWidth according to another array. I tried to do it with the following code:
x=[0:0.1:1]; y=sin(x);set = [0 0 0 1 1 0 0 1 1 0 0];
plot(x,y,'Color','b');hold;plot(x(set>0),y(set>0),'LineWidth',5,'color','b');
And I get this plot:

But as you see I wanted that there would be a middle part in which the line width is 1 instead of 5.
What is the correct way of doing this?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!