フィルターのクリア

Plot Legend

3 ビュー (過去 30 日間)
Jason
Jason 2011 年 4 月 7 日
Is there anyway to get rid of the first data with the legend() command? I just want it to show the second data, because the first data is a patch.
I have something like this:
legendtext = 'testing'
legend([repmat(' ',1,length(legendtext));legendtext], 'location', 'northeastoutside')
That code allow me to have text starting with the second data, but the symbol for the first data still show up because of it being a patch.

採用された回答

Jiro Doke
Jiro Doke 2011 年 4 月 7 日
If you look at the documentation for legend, there's a syntax where you can specify the handles to the graphics objects you want to create a legend for.
hPatch = patch([1 2.5 4 3 2], [2 1 2 3 3], [1 0.5 0.5]);
hold on;
hLines = plot(4*rand(5, 2));
% Create legend just for the lines
legend(hLines, 'Line 1', 'Line 2', 'Location', 'NortheastOutside');

その他の回答 (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