how write legend plot right side)

 Respuesta aceptada

Star Strider
Star Strider el 7 de Sept. de 2023
Try this —
x = linspace(0, 10);
y = randn(size(x,2), 5);
figure
plot(x, y)
legend(compose('Vector %2d',1:5), 'Location','NE')
.

7 comentarios

pipor
pipor el 7 de Sept. de 2023
i saw that legend but i dont want this
i want to display on right sidede
Dyuman Joshi
Dyuman Joshi el 7 de Sept. de 2023
Editada: Dyuman Joshi el 7 de Sept. de 2023
"but i dont want this"
That's what you showed in the image above - top right corner, and that's what @Star Strider did.
pipor
pipor el 7 de Sept. de 2023
at the bottom of each line there must be the name (not in the legend with the colors)..When you have many lines the legend becomes very messy...
pipor
pipor el 7 de Sept. de 2023
Movida: Voss el 7 de Sept. de 2023
i do it with octave...several year ago
Star Strider
Star Strider el 7 de Sept. de 2023
Editada: Star Strider el 7 de Sept. de 2023
I do not have your data, however something like this using the text function will work to put labels at the ends of the lines —
x = linspace(0, 2, 150);
y = (0:0.5:2).'+sin((1:5).'*2*pi*x);
figure
plot(x, y)
text(ones(1,4)*x(end), y(4:-1:1,end), {{'A'},{'B'},{'C'},{'D'}})
xlim(xlim+[0 0.1])
EDIT — (7 Sep 2023 at 21:05)
Corrected typographical errors.
.
pipor
pipor el 7 de Sept. de 2023
good!
Star Strider
Star Strider el 7 de Sept. de 2023
Thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 7 de Sept. de 2023

Comentada:

el 7 de Sept. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by