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
Chiara Modenese
2011년 3월 21일
카테고리
도움말 센터 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!