Why does my legend only display 50 entries?
Mostra commenti meno recenti
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)
Risposta accettata
Più risposte (1)
Eric Sargent
il 9 Dic 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 Commento
Walter Roberson
il 24 Dic 2020
It gets the axes handles from ancestor(p, 'axes') so it does not need to be passed a handle axes.
Categorie
Scopri di più su Legend 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!