Why does my legend only display 50 entries?
Mostrar comentarios más antiguos
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)
Respuesta aceptada
Más respuestas (1)
Eric Sargent
el 9 de Dic. de 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 comentario
Walter Roberson
el 24 de Dic. de 2020
It gets the axes handles from ancestor(p, 'axes') so it does not need to be passed a handle axes.
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!