Hello, I have 3 matrix (Eg: a=[0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1.0] , b=[0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;0.9;0.9], c=[0.4;0.5;0.6;0.7;0.8;0.9;0.3;0.2;0.1]) that I want to plot. How do I go about and plot this with different color indication for a,b and c (Eg: I want a to be blue, b to be red, and c to be yellow).

 採用された回答

BN
BN 2020 年 5 月 7 日

0 投票

Try this
plot (a, 'color', 'blue')
hold on
plot(b,'color', 'red')
hold on
plot (c,'color', 'yellow')
hold off
If you want to plot them separately ignore hold on and hold off. You can search for more colors if you need here

5 件のコメント

Chloe Sim
Chloe Sim 2020 年 5 月 7 日
Hello! Thank you for the quick response! I have tried the code! It works well.
However, is there a way where I can plot it with dots instead? So I can show each individual points.
BN
BN 2020 年 5 月 7 日
Yes you can use dots for example do this for each plot that you need:
plot (a,'.', 'color', 'blue')
you can use many more like '*' or '+', please take a look at this documantation.
Chloe Sim
Chloe Sim 2020 年 5 月 7 日
Hello! Thank you for the quick response! It works well! I have another question, how do I make the '*' and the labellings bigger in the plot?
BN
BN 2020 年 5 月 7 日
編集済み: BN 2020 年 5 月 7 日
Hi Yes you can doing this:
p1 = plot (a, '*', 'color', 'blue')
p1.LineWidth= 10;
Change 10 to 12 to bigger and 10 to 8 to smaller font, for example.
Chloe Sim
Chloe Sim 2020 年 5 月 7 日
Hello! Thank you for helping me! It works very well. Have a good day!

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2020 年 5 月 7 日

コメント済み:

2020 年 5 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by