legend dynamically updated
显示 更早的评论
Hi, my task would be to have a legend which is update dynamically as I loop over some data extracted from different files and I add them to a same plot, for instance. To put it better, I would like to "append" a label to my legend every time I update my plot. Would you know how to do it?
Chiara
4 个评论
John Bailey
2018-5-12
编辑:John Bailey
2018-5-12
plot(Pss,'DisplayName','desired legend entry')
legend('-DynamicLegend')
Place that after your first plot and it will automically put the name of the plot variable into the legend.
Walter Roberson
2018-5-12
Note that dynamic legends did not exist at the time the original question was asked in 2011.
Matthew
2018-9-25
Those were the days.
Moritz Stich
2022-3-31
Jon Bailey you are a dynamic legend. Thanks
采纳的回答
更多回答(2 个)
Matt Fig
2011-3-21
0 个投票
How are you updating the plot? In a loop?
1 个评论
rodolfo reyesbaez
2019-5-21
I added a hold on before ending the loop
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!