Why does my legend only display 50 entries?
Afficher commentaires plus anciens
I have a plot with more than 50 items and I would like to add a legend for all of them. The legend gets truncated at 50.
p = plot(magic(100));
labels = cellstr(num2str((1:100)'));
legend(p,labels)
Réponse acceptée
Plus de réponses (1)
Eric Sargent
le 9 Déc 2020
Legend will cap the number of entries at 50 if no handles are specified. To have all objects in an axes show up, pass in their handles to the legend command.
p = plot(magic(100));
legend(p);
1 commentaire
Walter Roberson
le 24 Déc 2020
It gets the axes handles from ancestor(p, 'axes') so it does not need to be passed a handle axes.
Catégories
En savoir plus sur Legend dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!