以八度为单位设置曲线的颜色

时间:2012-05-25 10:40:54

标签: matlab plot octave

我有两列数据,并希望使用八度音阶进行绘图。我做了以下事情:

 f = load('rate.txt','r')
 plot(f(:,1) ,f(:,2));
 plot(f(:,1));
 hold on;
 plot(f(:,2));

我得到了相应的图表。但两者颜色相同。我想为不同的图形和名称分配不同的颜色,就像这个彩色图是这个,这个彩色图是这样的。我该怎么办?

1 个答案:

答案 0 :(得分:2)

您可以使用line properties绘制下摆。 legend用于说明哪一个是什么。我想Octave使用与MATLAB相同的语法。这是一个示例代码段:

x = 0:0.01:5; %# An example x grid

plot(x,sin(x),'r-');
hold on;
plot(x,cos(x),'b--');
legend('sin', 'cos')

enter image description here