How to obtain handlers to line objects from a legend object?
4 次查看(过去 30 天)
显示 更早的评论
Is it possible to obtain the line-handlers from a legend-handler? Example:
hLines = plot(x1, y1, x2, y2, ...);
hLegend = legend(hLines, {'Text1', 'Text2', ...});
The figure, axes, lines and legend may now be changed via code or GUI. Some plotted lines are not included in the legend. Is there a way to obtain the lines that corresponds to the legend?
Best regards
0 个评论
采纳的回答
Walter Roberson
2018-6-5
In R2014b and later, if you have a legend, hLegend, that is displaying text for only some of the lines you passed in (for example you passed in too few text strings), and you wish to find out which line handles do have entries in the legend, then
hLegend.PlotChildren
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!