lines through markers on legend

10 visualizaciones (últimos 30 días)
Molepo Alfred
Molepo Alfred el 7 de Ag. de 2020
Comentada: Star Strider el 7 de Ag. de 2020
I am having a plot but on the legend, there are no lines through the markes. How can I fix this?.
The structure of the code is as follows:
x=-10:0.1:10;
y=cos(x);
plot(x,y,'--o','MarkerSize',5,'DisplayName',' cos(x)')
hold on
y=sin(x)
plot(x,y,'--d','MarkerSize',5,'DisplayName',' sin(x)')
hold off
legend
grid on
  3 comentarios
madhan ravi
madhan ravi el 7 de Ag. de 2020
Well it’s clearly a bug!
Star Strider
Star Strider el 7 de Ag. de 2020
This might have already been fixed.
Be certain you have installed all the Updates. On the top toolstrip, click Help then Check for Updates.

Iniciar sesión para comentar.

Respuestas (2)

madhan ravi
madhan ravi el 7 de Ag. de 2020
x = -10 : 0.1 : 10;
y = cos(x);
plot(x, y, '--o', 'MarkerSize', 5)
hold on
y = sin(x)
plot(x, y, '--d', 'MarkerSize', 5)
hold off
legend({'cos(x)', 'sin(x)'})
grid on
  3 comentarios
Molepo Alfred
Molepo Alfred el 7 de Ag. de 2020
I have v 2019b.
As you can see on the figure, the lines are not going theough the markers on the legend. Its only the markers that are showing.
madhan ravi
madhan ravi el 7 de Ag. de 2020
Seems like a bug to me. Try contacting MathWorks Support Team.

Iniciar sesión para comentar.


Arthur Roué
Arthur Roué el 7 de Ag. de 2020
You specified '--' option for your line style in 3rd argument of plot. If you want full lines, use '-' instead.
x=-10:0.1:10;
y=cos(x);
plot(x,y,'-o','MarkerSize',5,'DisplayName',' cos(x)')
hold on
y=sin(x)
plot(x,y,'-d','MarkerSize',5,'DisplayName',' sin(x)')
hold off
legend
grid on
  3 comentarios
Arthur Roué
Arthur Roué el 7 de Ag. de 2020
I do have lines in the legend with previous code. Seems like your MATLAB is not working correctly...
Arthur Roué
Arthur Roué el 7 de Ag. de 2020

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by