Plot one line with different linewidth according to a third array
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!