首页 > 解决方案 > 如何调整组合图中单条线的线宽?

问题描述

当我为这种类型的图调整线宽时,它可以工作。

plot(x1,y1, 'm','Linewidth',1)
hold on
plot(x2,y2, 'b','Linewidth',2)
hold on
plot(x3,y3, 'r','Linewidth',3)
hold on
plot(x4,y4, 'c','Linewidth',4)
hold on
plot(x5,y5, 'o','Linewidth',5)

但不是当我这样做的时候。

plot(x1, y1, 'm','Linewidth',1,x2, y2, 'b','Linewidth',2,x3, y3, 'r','Linewidth',3,x4, y4, 'c','Linewidth',4,x5, y5, 'o','Linewidth',5);

我得到一个错误。

是否可以调整组合图的线宽?

标签: matlabmatlab-figure

解决方案


是否可以调整组合图的线宽?

不(是的,但不是以更清洁的方式)。

如果你想要一条线,你可以一起调整所有参数。如果你想控制它们中的每一个的外观,你需要做单独的图。

您可以访问属性,但我怀疑这只是更长且不太清楚,所以不确定它是否真的是正确的解决方案。

h=plot(x1, y1, x2, y2, ...);
h(1).LineWidth=1;
h(2).LineWidth=2;
...

推荐阅读