Plot: legend with spurious entries

9 ビュー (過去 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 Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by