Plot one line with different linewidth according to a third array
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!