Plotting 10 graphs with different colors and markers

59 次查看(过去 30 天)
Hi everyone, I am plotting 10 graphs on a single figure from a different 10 sets of data. I know only these 5 colors and markers in Matlab to differentiate between them. Can you help me to get 5 more. Thank you.
colors=['-rs'; '-bo'; '-k^'; '-y+'; '-c*'];
  1 个评论
Ali
Ali 2017-10-29
if true
--------------------------------------------------- code start
This is an example for your case Aftab Ahmed
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

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2015-3-26
编辑:Star Strider 2015-3-26
Choose the colormap you want, and specify the number of levels you want.
For example:
cmap = colormap(parula(10));
then for the 7th plot, you might call plot as:
hold on
for k1 = 1:10
plot([1:10], randi(k1*5, 1, 10), 'Color',cmap(k1,:))
end
hold off
grid
You can also set the 'AxisColorOrder' and 'AxisLineStyleOrder' by default or for each axis (this example taken from another post):
set(0,'defaultaxescolororder',[0 0 0; 0.5 0.5 0.5]) %black and gray
set(0,'defaultaxeslinestyleorder',{'-*',':','o'}) %or whatever you want
In R2014b and later, replace the ‘0’ with groot.

更多回答(2 个)

Andrew Newell
Andrew Newell 2015-3-26
There is a table in LineSpec (Line Specification) with 13 different markers.

Korosh Agha Mohammad Ghasemi
编辑:Korosh Agha Mohammad Ghasemi 2020-12-7
%https://zil.ink/korosh -------- Ways to contact me ----------
% Korosh Agha Mohammad Ghasemi !
% Chemical Engineering at Shiraz University
x=linspace(0,2,100);
figure;
for a=[0.1 0.5 1 2 4]
y=x.^a; %The function is hypothetical
if a == 0.1 %Any color can be substituted
y=x.^a;
plot(x,y,'k') %Now choose the color
hold on
elseif a == 0.5
y=x.^a;
plot(x,y,'b') %Now choose the color
hold on
elseif a==1
y=x.^a;
plot(x,y,'g') %Now choose the color
hold on
elseif a==2
y=x.^a;
plot(x,y,'r') %Now choose the color
hold on
elseif a==4
y=x.^a;
plot(x,y,'y') %Now choose the color
hold on
grid on
end
end

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by