How to combine a marker to a line and show in legend?
10 views (last 30 days)
Show older comments
Abdullah Hussein
on 13 Aug 2022
Commented: Star Strider
on 14 Aug 2022
f=figure(4);
set(f,'Color','w');
aa = gca;
line(Vs1,Depth1','Color','k','LineStyle','-','LineWidth',2)
hold on
line(Vs2,Depth2','Color','b','LineStyle','-','LineWidth',2)
hold on
line(Vs3,Depth3','Color','r','LineStyle','-','LineWidth',2)
hold on
line(Vs4,Depth4','Color','g','LineStyle','-','LineWidth',2)
hold on
line(Vs5,Depth5','Color','m','LineStyle','-','LineWidth',2)
hold on
scatter(Vs1,Depth1,50,'o','MarkerEdgeColor','k','MarkerFaceColor',["auto"]);
hold on
scatter(Vs2,Depth2,70,'s','MarkerEdgeColor','b','MarkerFaceColor',["auto"]);
hold on
scatter(Vs3,Depth3,70,'d','MarkerEdgeColor','r','MarkerFaceColor',["auto"]);
hold on
scatter(Vs4,Depth4,50,'^','MarkerEdgeColor','g','MarkerFaceColor',["auto"]);
hold on
scatter(Vs5,Depth5,50,'<','MarkerEdgeColor','m','MarkerFaceColor',["auto"]);
hold on
ax = gca;
ax.GridColor = ['k'];
ax.GridLineStyle = '--';
ax.GridAlpha = 0.5;
ax.Layer = 'bottom';
set(gca,'fontsize',15,'linewidth',1.5);
ylim([60 305]);
xlim([0 0.8]);
set(gca,'box','on', 'XGrid','of');
hold off
lgd=legend(['\fontsize{12}','U1244'],['\fontsize{12}','U1245'],['\fontsize{12}','U1247'],['\fontsize{12}','U1326'],['\fontsize{12}','U1327'],'location','southwest');
legend boxoff
set(lgd,'Location','best')
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!