Borrar filtros
Borrar filtros

Getting gray colored lines in a line plot

82 visualizaciones (últimos 30 días)
Marin
Marin el 25 de Ag. de 2012
Comentada: Juan Agullo el 23 de Mzo. de 2021
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!

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 25 de Ag. de 2012
Editada: Azzi Abdelmalek el 25 de Ag. de 2012
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 comentarios
Jonathan Arias
Jonathan Arias el 8 de Dic. de 2020
beautiful! it works!
Juan Agullo
Juan Agullo el 23 de Mzo. de 2021
Thanks! works really well

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by