Plot Legend
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there anyway to get rid of the first data with the legend() command? I just want it to show the second data, because the first data is a patch.
I have something like this:
legendtext = 'testing'
legend([repmat(' ',1,length(legendtext));legendtext], 'location', 'northeastoutside')
That code allow me to have text starting with the second data, but the symbol for the first data still show up because of it being a patch.
0 commentaires
Réponse acceptée
Jiro Doke
le 7 Avr 2011
If you look at the documentation for legend, there's a syntax where you can specify the handles to the graphics objects you want to create a legend for.
hPatch = patch([1 2.5 4 3 2], [2 1 2 3 3], [1 0.5 0.5]);
hold on;
hLines = plot(4*rand(5, 2));
% Create legend just for the lines
legend(hLines, 'Line 1', 'Line 2', 'Location', 'NortheastOutside');
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!