Plot legend with 2-d layout

18 visualizaciones (últimos 30 días)
dormant
dormant el 28 de Mayo de 2024
Comentada: Voss el 3 de Jun. de 2024
Is it possible to do four (or more) plots using hold on and then create a legend that has a 2-d layout like this?

Respuesta aceptada

Voss
Voss el 28 de Mayo de 2024
You can at least get close:
x = 1:10;
y = randi(10,10,4);
figure
hold on
markers = '^^oo';
colors = 'rbrb';
names = ["A_";"B_"]+["i","j"];
for ii = 1:size(y,2)
plot(x,y(:,ii),markers(ii),'Color',colors(ii),'DisplayName',names(ii));
end
legend('NumColumns',2)
  2 comentarios
dormant
dormant el 3 de Jun. de 2024
Thank you very much.
Voss
Voss el 3 de Jun. de 2024
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Legend en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by