Combine Plot and Scatter in Legend
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Théo
am 25 Apr. 2023
Kommentiert: Théo
am 25 Apr. 2023
Hello eveyone,
I have this graph :
In the legend I would like to display the curve and the scatter like that :
Tere is my code :
fig = figure;
set(fig, 'Units', 'Normalized', 'Position', [0.2 0.2 0.45 0.35]);
plot(B,A,"k",'LineStyle',':','linewidth',2)
hold on
s = scatter(B,A,35,'filled','diamond')
s.MarkerEdgeColor = "#BDD7EE";
s.MarkerFaceColor = "#D9D9D9";
plot(B,Abis,"k",'LineStyle','--','linewidth',1)
hold on
s2 = scatter(B,Abis,35,'filled','o')
s2.MarkerEdgeColor = "k";
s2.MarkerFaceColor = "#BDD7EE";
plot(B,MoyMatrice,"r",'LineStyle','-','linewidth',1)
hold on
scatter(B,MoyMatrice,35,'r','filled','o')
xlabel('Note subjective du broutement')
ylabel('Rating Occurence')
legend ('Run 1','Run 2','GLOBAL')
ylim ([0 maxx]) ;xlim([4 9]) %Fixer les limites d'axe
title (titre,'Interpreter','none')
ax = gca;
ax.XGrid = 'off';
ax.YGrid = 'on';
ytickformat('percentage')
text(4.1,maxy-2,txt_Moyenne,'FontSize',14)
Thanks for considering !
0 Kommentare
Akzeptierte Antwort
chicken vector
am 25 Apr. 2023
x = 1:10;
y1 = randi(10,1,10);
y2 = randi(10,1,10);
y3 = randi(10,1,10);
figure;
hold on;
grid on;
plot(x,y1,':d',...
'LineWidth',2,...
'Color','k',...
'MarkerSize',10,...
'MarkerEdgeColor','#BDD7EE',...
'MarkerFaceColor','#D9D9D9')
plot(x,y2,'--o',...
'LineWidth',1,...
'Color','k',...
'MarkerSize',10,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','#BDD7EE')
plot(x,y3,'-o',...
'LineWidth',1,...
'Color','r',...
'MarkerSize',10,...
'MarkerEdgeColor','r',...
'MarkerFaceColor','r')
hold off;
legend('Curve 1','Curve 2','Curve 3','Location','NorthEastOutside');
Result:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots 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!