Problems with legend
조회 수: 1 (최근 30일)
이전 댓글 표시
hello, in my program i have the following plots:
u = [0.4 mnd12005lu];
q = mnd12005sd;
g = [q(1:end-2) ;q(2:end-1); q(3:end)];
t = [0 0 0]; % vektor for de tre første dager (29. des, 1 og 2 jan) for snødybde ved bruk til kristiansentrippel.
zeiglersum = ((2*pi).*mnd12005lu' + 3.6.*mnd12005sd')';
foerdesfaktor = (4.7.*mnd12005lu' + 0.3.*mnd12005sd'.^2)';
grinismaksimum = max(u(1:end-1),u(2:end));
kristiansenstrippel = [mean(t) mean(g)];
hennestadsminimum = min (zeiglersum, grinismaksimum) - 5;
plot (zeiglersum, 'k-')
axis([0 32 -inf inf])
legend ('zeiglersum','foerdesfaktor,'-4.*grinismaksimum', '3.*kristiansenstrippel', 'hennestadsminimum')
hold on
plot(foerdesfaktor, 'm --','linewidth',2)
hold on
plot(-4.*grinismaksimum, 'c : .')
hold on
plot(3.*kristiansenstrippel, 'r -.')
hold on
plot(hennestadsminimum, 'g :')
hold off
When i run the plot, only the legend for 'zeiglersum' shows up. i also get the following message:
Warning: Ignoring extra legend entries. > In legend at 294 In OBLIG2 at 63
OBLIG2 is the program
댓글 수: 0
채택된 답변
Walter Roberson
2011년 11월 9일
Move the legend() call to below the place you plot the last value.
I believe, by the way, that you are missing an "'" immediately after "'foerdesfaktor" in your legend() call.
댓글 수: 0
추가 답변 (1개)
Thomas
2011년 11월 9일
Hmm, intial walkthorugh your code
legend ('zeiglersum','foerdesfaktor,'-4.*grinismaksimum',
'3.*kristiansenstrippel', 'hennestadsminimum')
in the legend line you have not completed tick for 'foerdesfaktor'
the line should read:
legend ('zeiglersum','foerdesfaktor','-4.*grinismaksimum', '3.*kristiansenstrippel', 'hennestadsminimum')
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!