I tried to have a following legend in a plot
legend([Plot1, Plot2, Plot3],'6 bidders (Mean ' + string(mean(OutputSpacing(:,1))) + ', Std: ' + string(std(OutputSpacing(:,1))) +')','12 bidders (Mean ' + string(mean(OutputSpacing(:,2))) + ', Std: ' + string(std(OutputSpacing(:,2))) +')','24 bidders (Mean ' + string(OutputSpacing(:,3)) + ', Std: ' + string(std(OutputSpacing(:,3))) +')')
Then I got a following message
Warning: Ignoring extra legend entries.
> In legend>set_children_and_strings (line 674)
In legend>make_legend (line 346)
In legend (line 294)
In test (line 1001)
Please advise.

 採用された回答

Star Strider
Star Strider 2018 年 4 月 5 日

0 投票

One possible solution:
OutputSpacing = rand(3);
figure
plot(1:3, OutputSpacing, 'p')
lgndcell = regexp(sprintf('%2d Bidders (Mean: %.2f, Std: %.2f)\n', [[6 12 24]; mean(OutputSpacing); std(OutputSpacing)]), '\n', 'split');
legend(lgndcell(1:end-1))
You will probably need to tweak it to work with your data and plots. (It works with this code.)

2 件のコメント

alpedhuez
alpedhuez 2018 年 4 月 5 日
Thank you.
Star Strider
Star Strider 2018 年 4 月 5 日
As always, my pleasure.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 4 月 5 日

0 投票

You pass in three handles but six legend strings.

1 件のコメント

alpedhuez
alpedhuez 2018 年 4 月 5 日
What does it mean?

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

カテゴリ

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by