
How to plot lines with different width in the same figure?
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
André Teixeira
el 13 de Mayo de 2016
Comentada: Chad Greene
el 13 de Mayo de 2016
Hello, i want to know if there is any way to plot various lines in the same figure with different width:
I have this simple code to serve as a example:
x1=[0 0];
y1=[0 3];
x2=[0 4];
y2=[3 3];
x3=[4 4];
y3=[3 0];
plot(x1,y1,'b',x2,y2,'r',x3,y3,'g','LineWidth',4);
axis([-1 5 -1 4]);
Is there a way that the blue line formed by x1,y1 to have a different thickness than the red line created by x2,y2 and so on?
Thanks for any help
0 comentarios
Respuesta aceptada
Chad Greene
el 13 de Mayo de 2016
Yes, it's possible! I'd plot them individually and remember to set hold on so it won't delete the previous plot with each call of plot:
x1=[0 0];
y1=[0 3];
x2=[0 4];
y2=[3 3];
x3=[4 4];
y3=[3 0];
plot(x1,y1,'b','linewidth',1)
hold on
plot(x2,y2,'r','linewidth',3)
plot(x3,y3,'g','LineWidth',5);
axis([-1 5 -1 4]);

1 comentario
Chad Greene
el 13 de Mayo de 2016
Or if you prefer a more reasonable green, you can specify rgb values:
plot(x3,y3,'-','LineWidth',5,'color',[0.08 0.69 0.1]);

Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!