フィルターのクリア

How to obtain different color graphs for a single matrix?

1 回表示 (過去 30 日間)
NIHARIKA
NIHARIKA 2014 年 7 月 17 日
回答済み: Jos 2014 年 7 月 17 日
I have obtained varying readings from a sensor in the form of a 78x3 matrix. I have named this matrix as data. Now when perform: plot(data) then I get three same lines. I need to know which are the readings of the first column, second column and third column and want different color for each of them so that anybody can understand it. How can I do it?
  1 件のコメント
Matz Johansson Bergström
Matz Johansson Bergström 2014 年 7 月 17 日
Can you upload the data so we can see?

サインインしてコメントする。

採用された回答

Jos
Jos 2014 年 7 月 17 日
Strange, when I produce a 78x3 matrix using data=rand(78,3); and then do plot(data) it shows 3 lines in the standard blue, green and red used by Matlab.
But if it doesn't do the same for you, you can plot each column separately and give it a colour by:
plot(data(:,1),'b')
hold on
plot(data(:,2),'g')
plot(data(:,3),'r')
add a legend by using legend('column1','column2','column3')
Cheers
Joe

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by