How to set Marker in loop

조회 수: 59 (최근 30일)
John
John 2017년 10월 27일
편집: per isakson 2019년 6월 22일
This is what I combined from this forum:
set(0,'defaultaxeslinestyleorder',{'+','o','*','.','x','s','d','^'});
hold all
for n=1:8
p=plot(x,ddmax(:,n));
end
legend('1','2','3','4','5','6','7','8')
But what it produced is 7 '+' and a 'o', see picture. What did I do wrong?
  댓글 수: 3
John
John 2017년 10월 27일
편집: John 2017년 10월 27일
x is 40; ddmax 40x8; see attached plot picture; 8 plots, needs 8 different markers;
Ali
Ali 2017년 10월 29일
편집: Walter Roberson 2017년 10월 29일
--------------------------------------------------- code start This is an example for your case
Input is "Input_Data", two dimension matrix
Marker_Counter=1;
figure6=figure;
Markers = {'+','o','*','x','v','d','^','s','>','<'};
for i=1:10:size(Input_Data,1)
TPR=Input_Data(i:i+9,7);
FPR=Input_Data(i:i+9,8);
plot(FPR,TPR,strcat('-',Markers{Marker_Counter}));
Marker_Counter=Marker_Counter+1;
hold on
end
plot([0.5 1],[0.5 1],'--');
legend('Minpts = 100','Minpts = 200','Minpts = 300','Minpts = 400','Minpts = 500','Minpts = 600','Minpts = 700','Minpts = 800','Minpts = 900','Minpts = 1000','','Location','SouthEast');
xlabel('FPR or (1-Specificity)','FontSize',12,'FontWeight','bold'); ylabel('TPR or Spensitivity)','FontSize',12,'FontWeight','bold');
title('ROC Space');
close(gcf);
-------------------------------------------- code end
--------------------------------------- picture link preview

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

채택된 답변

Walter Roberson
Walter Roberson 2017년 10월 27일
"Axes increments the line style only after using all of the colors in the ColorOrder property. It then uses all the colors again with the second line style, and so on. "
  댓글 수: 4
John
John 2017년 10월 27일
Still doesn't work.
set(groot,'defaultAxesColorOrder',[1 0 0;1 0 1;0 1 0;0 0 1],...
'defaultAxesLineStyleOrder','+-|o-|v-|s-|p-|h-|d-|^-')
plot(x,ddmax);
Bellow is what above script produced:
Bellow is what we wanted:
>>
Walter Roberson
Walter Roberson 2017년 10월 27일
You cannot do that automatically. The next line style will not be looked at until all colors have been used once. There is no provision using the defaults to advance one marker for each color. You would need to set the properties of the line handles.

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

추가 답변 (1개)

Bruno Melo
Bruno Melo 2019년 6월 20일
편집: per isakson 2019년 6월 22일
I had the same issue and got around by using this function made by Sébastien Martin.
Hope it helps you.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by