Add Legend Automatically Based on Tag Property Value

Add legend to axes based on values from plot handles Tag property
ダウンロード: 96
更新 2016/7/30


Instead of adding a legend manually and making sure the colors are consistent, use the 'Tag' property for each plot to separate them. Then use the function add_legend to add a legend. The function groups all plots based on their Tag property, and give each group a separate color. It uses the Tag property values as labels in the legend.
I have included the function varycolor by Daniel Helmick:


Hannes Mogensen (2024). Add Legend Automatically Based on Tag Property Value (, MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2016a
Windows macOS Linux
Help Center および MATLAB AnswersLegend についてさらに検索
タグ タグを追加

ヒントを得たファイル: varycolor

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート

Added credit to Daniel Helmick

Updated description