Showing markers to plot legend
Mostra commenti meno recenti
Hiya! I got this code (below) and I want to add the markers to a legend, how would I go about this?
figure(4); clf
p = plot(faun.age, faun.depth, '-diamond', 'LineWidth', 1.2);
grid on
set(gca, 'YDir', 'reverse')
xlabel('Age (ka BP)')
ylabel('Depth (mm)')
title('Age-Depth Relationship with Nps data')
p.MarkerEdgeColor = [1 0.5 0];
Risposte (2)
Star Strider
il 10 Nov 2026 alle 22:15
1 voto
Add that and it should work.
There are two closely related ways to handle this.
faun.age = [5 7 4 9];
faun.depth = [2 3 4 3];
figure(1)
p = plot(faun.age, faun.depth, '-diamond', 'LineWidth', 1.2, 'displayname', 'depth');
grid on
set(gca, 'YDir', 'reverse')
xlabel('Age (ka BP)')
ylabel('Depth (mm)')
title('Age-Depth Relationship with Nps data')
p.MarkerEdgeColor = [1 0.5 0];
legend show
figure(2)
p = plot(faun.age, faun.depth, '-diamond', 'LineWidth', 1.2);
grid on
set(gca, 'YDir', 'reverse')
xlabel('Age (ka BP)')
ylabel('Depth (mm)')
title('Age-Depth Relationship with Nps data')
p.MarkerEdgeColor = [1 0.5 0];
legend('depth')
Categorie
Scopri di più su Lighting, Transparency, and Shading in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

