Adding colors to the plots in loop
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Najam us Saqib Fraz
el 26 de Mayo de 2021
Comentada: Najam us Saqib Fraz
el 26 de Mayo de 2021
I have a loop that do a function forteen times.Each time it averages some values and makes a plot.It means there are are fourteen plots at on one graph.I am having problem with the colors of these plots.I want to give each plot a black color line with some squares,or cross,or diamonds etc.I made a new vector cotaining all the names of the color and each time it should select one of the color.Some of my code is shown below
colors=['k+:','k.-','kx-','k+-','k*-','ks-','kd-','kv-','k^-','k<-','k>-','kp-','kh-','k--'];
for k=1:1:length(BigMa_1); # Length of BigMa_1 is 14
code
plot(vector./100,yi,colors(k),'DisplayName',['Step No',' ',num2str(k)],'LineWidth',1);
end
Problem is it does not display the black lines.It shows some weird shapes.I am stuck here for two months.Can any one help me in this regard.I need to produces black line with different symbols like plus,square,star ets data poinst
0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Mayo de 2021
colors = {'k+:','k.-','kx-','k+-','k*-','ks-','kd-','kv-','k^-','k<-','k>-','kp-','kh-','k--'};
for k=1:1:length(BigMa_1); % Length of BigMa_1 is 14
code
plot(vector./100,yi,colors{k},'DisplayName',['Step No',' ',num2str(k)],'LineWidth',1);
end
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Fundamentals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!