フィルターのクリア

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 Center および File ExchangeLegend についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by