legappend

版本 1.0.0.0 (45.2 KB) 作者: Chad Greene
Append new entries to an existing legend
6.6K 次下载
更新时间 2014/7/14

查看许可证

编者注: This file was selected as MATLAB Central Pick of the Week

The legappend function adds new entries to a legend. This is good for making PowerPoint slides, when you may want to start by plotting a few data sets, then add data to your plot one entry at a time. This function eliminates the need to copy and paste the complete legend creation code each time you add a curve to a plot, and alleviates the minor headaches you'd experience if you decided to rearrange the order in which items are plotted.

Description
legappend('new legend entry') appends an existing legend with "new legend entry".

legappend('new entry 1','new entry 2',...,'new entry N') adds several new entries to the legend.

legappend('') deletes the last entry from the legend.

legappend('','',...,'') deletes the last several entries from the legend.

[legend_h,object_h,plot_h,text_strings] = legappend(...) returns legend_h, the handle of the new legend; object_h, handles of the line, patch, and text graphics objects used in the legend; plot_h, handles of the lines and other objects used in the plot; and text_strings, a cell array of the text strings used in the legend. Note that for new legend entries, legappend does not add entries to a current legend, but deletes the current legend and recreates a new one. As a result, the legend handle will change with each new-entry use of legappend. The legend handle does not change when legappend is used to delete an entry.

引用格式

Chad Greene (2024). legappend (https://www.mathworks.com/matlabcentral/fileexchange/47228-legappend), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012b
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

参考作品: grayout

启发作品: legappend, HG2 Legend Tools, label, legalpha

Community Treasure Hunt

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

Start Hunting!

legappend/html/

版本 已发布 发行说明
1.0.0.0