Getting gray colored lines in a line plot

Hi,
so I have this plot and there are several lines that I need to plot and I would like some of them to be black, some colored (I know how to do that) and some gray. So how do I get the gray color? And, also, how do I control it? I would like some of the gray lines to be darker and some lighter.
Thank You in advance!

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 25 日
編集済み: Azzi Abdelmalek 2012 年 8 月 25 日

10 投票

plot(t,y,'color',[0,0,0 ]) % Black
plot(t,y,'color',[0,0,0]+alpha) % for alpha= 0 to 1 the lines will be more clear
% example
t=0:0.1:10;y=sin(t)
for k=1:20
plot(t,y,'linewidth',8,'Color',[0 0 0]+0.05*k);pause(0.5);
end

4 件のコメント

Marenostre
Marenostre 2017 年 4 月 22 日
great!!
Muhammad Zayed
Muhammad Zayed 2020 年 8 月 25 日
That's exactly what I am looking for! Thanks a lot!
Jonathan Arias
Jonathan Arias 2020 年 12 月 8 日
beautiful! it works!
Juan Agullo
Juan Agullo 2021 年 3 月 23 日
Thanks! works really well

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLine Plots についてさらに検索

質問済み:

2012 年 8 月 25 日

コメント済み:

2021 年 3 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by