DisplayName when plotting matrices
86 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vittorio Picco
el 7 de En. de 2022
Respondida: Walter Roberson
el 8 de En. de 2022
I don't seem to be able to set the DisplayName of a bunch of lines at once. For example,
h = plot(rand(3),'DisplayName',{'1','2','3'});
does not work. Similarly, I can't get the set command to work on all the lines at once. The only way I manage to do it is with a loop:
h = plot(rand(3));
for ind = 1:3
set(h(ind),'DisplayName',num2str(ind))
end
Is that the only way?
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de En. de 2022
It can be a nuisance to get the syntax right, but it is possible to change the DisplayName in bulk. But not using the 'DisplayName' option of plot()
h = plot(rand(3));
set(h, {'DisplayName'}, {'1'; '2'; '3'})
legend show
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
