필터 지우기
필터 지우기

Problems with legend

조회 수: 1 (최근 30일)
peri
peri 2011년 11월 9일
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

채택된 답변

Walter Roberson
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.

추가 답변 (1개)

Thomas
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')
  댓글 수: 1
peri
peri 2011년 11월 9일
ive changed that and still it wont work

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

카테고리

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