필터 지우기
필터 지우기

Adding colors to the plots in loop

조회 수: 7 (최근 30일)
Najam us Saqib Fraz
Najam us Saqib Fraz 2021년 5월 26일
댓글: Najam us Saqib Fraz 2021년 5월 26일
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

채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 26일
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
  댓글 수: 1
Najam us Saqib Fraz
Najam us Saqib Fraz 2021년 5월 26일
Thanks Alot....Never thought It so simple...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by