Plot: legend with spurious entries

조회 수: 10 (최근 30일)
Stefan Boeters
Stefan Boeters 2016년 10월 28일
댓글: KSSV 2016년 10월 28일
When I run the following plotting code:
data = randn(100,1);
plot(data)
hold on;
plot(zeros(100),':','Color',[0.5 0.5 0.5]);
hold off;
legend('Testdata')
legend('Location','north')
I get the following strange result:
Looks like a bug to me. When I delete the last line of code (replacement of the legend), it works well. Do I miss something?
  댓글 수: 1
KSSV
KSSV 2016년 10월 28일
편집: KSSV 2016년 10월 28일
Me too got same result. This works:
data = randn(100,1);
plot(data)
hold on;
plot(zeros(100),':','Color',[0.5 0.5 0.5]);
hold off;
legend('Testdata','Location','north')

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2016년 10월 28일
I can confirm this behavior with Matlab R2009a: Changing the location afterwards does not work.
  댓글 수: 1
KSSV
KSSV 2016년 10월 28일
Same behavior with 2015a..

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by