如何更改 Matlab 图中的线条颜色?
How to change line colors in Matlab plot?
初学者的问题。。。在帮助/网上也没找到!
如何在 Matlab 中创建一个图,其中一条线是黑色的,一条线是灰色的虚线?我能想出的最好的代码贴在下面,但它不起作用...
figure;
plot( datevector, data1, 'color', [0 0 0],...
datevector, data2, '--', 'color', [0.5 0.5 0.5],...
'LineWidth',1.2 );
来自 Matlab 文档:
plot(___,Name,Value) specifies line properties using one or more Name,Value pair arguments. Use this option with any of the input argument combinations in the previous syntaxes. Name,Value pair settings apply to all the lines plotted. You cannot specify different Name,Value pairs for each line using this syntax.
您可以使用 hold on
绘制具有不同属性的多条线:
plot( datevector, data1, 'Color', [0 0 0]);
hold on
plot(datevector, data2, 'LineStyle','--', 'Color', [0.5 0.5 0.5],'LineWidth',1.2 );
初学者的问题。。。在帮助/网上也没找到! 如何在 Matlab 中创建一个图,其中一条线是黑色的,一条线是灰色的虚线?我能想出的最好的代码贴在下面,但它不起作用...
figure;
plot( datevector, data1, 'color', [0 0 0],...
datevector, data2, '--', 'color', [0.5 0.5 0.5],...
'LineWidth',1.2 );
来自 Matlab 文档:
plot(___,Name,Value) specifies line properties using one or more Name,Value pair arguments. Use this option with any of the input argument combinations in the previous syntaxes. Name,Value pair settings apply to all the lines plotted. You cannot specify different Name,Value pairs for each line using this syntax.
您可以使用 hold on
绘制具有不同属性的多条线:
plot( datevector, data1, 'Color', [0 0 0]);
hold on
plot(datevector, data2, 'LineStyle','--', 'Color', [0.5 0.5 0.5],'LineWidth',1.2 );