Add legend in plot in Appdesigner

145 ビュー (過去 30 日間)
Happy PhD
Happy PhD 2022 年 4 月 13 日
回答済み: Happy PhD 2022 年 4 月 13 日
Hi, I am doing some image processing and I like to plot the result for each added image as a new legend. Number of legends can be random, 5 to 15, or more.
How do I add legend for image data 1, image data 2 etc.
Basically i click on a button and take a snapshot, do some analysis on the image and then plot the data from the analysis in a figure called app.UIAxes.
Take a new picture,.. and repeat the process. So now there is a second curve.
My code that isn't working:
hold(app.UIAxes,'on')
plot(app.UIAxes,app.data,maxSh ,'o','DisplayName', [num2str(app.dist)],'Color',rand(1,3));
hold(app.UIAxes,'off')
The legend for each new curve should be the value of num2str(app.dist).
Thanks!

採用された回答

Happy PhD
Happy PhD 2022 年 4 月 13 日
Solved the problem.
I had to add
legend(app.UIAxes);
to make it visible.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by