필터 지우기
필터 지우기

Plotting with different colored markers

조회 수: 53 (최근 30일)
Rainer
Rainer 2012년 11월 27일
편집: Ali 2017년 10월 29일
Hi All,
As you know, the plot command gives each line a different color so that the user can distinguish between the each dataset. When you have two lines, you have 2 colors...6 lines, 6 colors etc. Very convenient.
How can I do this but for markers instead? The number of datasets I want to plot is different each time...I might have 2,3,4,5 up to x datasets. Is there a way to represent each set using a different marker (when the number of sets is variable)?
  댓글 수: 1
Ali
Ali 2017년 10월 29일
편집: Ali 2017년 10월 29일
if true
--------------------------------------------------- code start
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
end
--------------------------------------- picture link preview
<</matlabcentral/answers/uploaded_files/92608/untitled.bmp>>

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

채택된 답변

Image Analyst
Image Analyst 2012년 11월 27일
You can use scatter() and give each marker its own color if you want. You can put them on top of a line/curve plot if you want if you call "hold on" in between calls to plot() and scatter().
  댓글 수: 2
myetceteramail myetceteramail
myetceteramail myetceteramail 2017년 4월 14일
how to give each marker different colour using scatter
Image Analyst
Image Analyst 2017년 4월 14일
One of the inputs to scatter is a list of colors for each marker.

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

추가 답변 (2개)

Matt Fig
Matt Fig 2012년 11월 27일
편집: Matt Fig 2012년 11월 27일
You can set the linestyleorder.
clf
set(gca,'linestyleorder',{'-',':','-.','--'},...
'colororder',[0 0 1;0 .5 0;1 0 0],...
'nextplot','add')
x = 0:.01:1;
plot(x,bsxfun(@power,x.',1:12))

Nilesh Salvi
Nilesh Salvi 2012년 11월 27일
Express the color to be assigned in plot function as RGB-Value rather than 'Short name'. To get a new color generated for every time plot function is called I assign random RGB value to the color spec. http://goo.gl/hq6q4
for i = 1:N
plot(x,y(i),[rand rand rand]);
end
that should plot N number of 'y' curves of N random shades.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by