Plot Legend
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
Jiro Doke
am 7 Apr. 2011
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!