The legend show different sign

2 ビュー (過去 30 日間)
K
K 2012 年 11 月 29 日
Hello, I try to plot my graph and also do the legend. However, the legend show a different type of symbol. The example of my code is as below. However when I run my simulation, both current and voltage have symbol ro.
figure(1) hold on
for ii=1:N voltage... resistance.. .. xx(ii) = ii; plot(ii,voltage, 'ro'); end
plot(xx,current, 'rx'); legend('voltage','current',2);

採用された回答

Arthur
Arthur 2012 年 11 月 29 日
This is because you are plotting data in a loop, and will make N plots with symbol 'ro'. Therefore, also the first N entries in the legend will have 'ro'.
You can fix this by collecting all voltage data in one array, and create a single plot. If that is not possible due to the structure of the data, you can set the handleVisibility to 'off' for all voltage plots with ii > 1. This means they will be skipped in the legend.
  2 件のコメント
K
K 2012 年 11 月 29 日
How can I set the handleVisibility to off?
K
K 2012 年 11 月 29 日
Thanks guys for your reply. I use this code plot(ii,voltage, 'ro', ''HandleVisibility', 'off');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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