lines through markers on legend
이전 댓글 표시
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
Molepo Alfred
2020년 8월 7일
madhan ravi
2020년 8월 7일
Well it’s clearly a bug!
Star Strider
2020년 8월 7일
This might have already been fixed.
Be certain you have installed all the Updates. On the top toolstrip, click Help then Check for Updates.
답변 (2개)
madhan ravi
2020년 8월 7일
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
madhan ravi
2020년 8월 7일
Running your code in 2020 gave me the desired result. What version are you running on?
Molepo Alfred
2020년 8월 7일
madhan ravi
2020년 8월 7일
Seems like a bug to me. Try contacting MathWorks Support Team.
Arthur Roué
2020년 8월 7일
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
Molepo Alfred
2020년 8월 7일
Arthur Roué
2020년 8월 7일
I do have lines in the legend with previous code. Seems like your MATLAB is not working correctly...
Arthur Roué
2020년 8월 7일

카테고리
도움말 센터 및 File Exchange에서 Legend에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!