How to mark different values with different colors and markers
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Learner
am 11 Mai 2014
Beantwortet: Korosh Agha Mohammad Ghasemi
am 7 Dez. 2020
Hi,
I have a complex data values:
Z = X+iY =
0.1 0.2
-75.7 1.1
-1.0 4.1
-2.0 4.3
-1.7 5.6
-0.9 7.3
0.0 7.3
0.7 5.1
1.2 0.0
-1.3 9.0
-0.9 5.1
0.0 0.2
0.0 0.0
The first column is values of X axis (real) and second column value is Y axis (imaginary)
What I want to do is: Plot all 13 points with different color and marker and marksize.
-----------------------------
I tried this approach:
plot(Z(1,:),'g+','MarkerSize',10, Z(2,:),'c^','MarkerSize',8, .....)
-----------------------------
^^ But this approach is not working!!
Please help me out.
Thanks in advance.
1 Kommentar
Ali
am 29 Okt. 2017
if true
--------------------------------------------------- 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
end
--------------------------------------- picture link preview
Akzeptierte Antwort
dpb
am 11 Mai 2014
plot creates a line object and the above are all global properties of the line.
To put them on as differently you'd have to place each point with scatter which is what it seems you're looking for, anyway.
doc scatter
for more details; reply herein if that doesn't solve the problem.
2 Kommentare
Image Analyst
am 11 Mai 2014
That's because all your markers are 'r', which is red, not the different colors like you want. Pass in an N by 3 array instead, like jet(size(Z_real, 1)).
Weitere Antworten (2)
dpb
am 11 Mai 2014
Basics are as follows--
fmt=['%.2f + %.2fi']; % build a format string for complex
scatter(Z(:,1),Z(:,2)) % plot the points
text(Z(:,1),Z(:,2),num2str(Z,fmt)) % label them per the formatting
Salt to suit; your values overlap enough may need to do some selective placement or orientation to be able to read 'em all.
0 Kommentare
Korosh Agha Mohammad Ghasemi
am 7 Dez. 2020
%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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Phased Array Design and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!