What's the alternative of DisplayName in App Designer?
5 views (last 30 days)
Show older comments
Davide Verga
on 16 Jun 2021
Commented: Davide Verga
on 17 Jun 2021
In the old GUIDE, I was using this code in a for loop, in order to label my plot:
txt = [strrep(handles.item{iFile},'_','-'),' Fz = ',num2str(Fz(1,iLoad)),' - \gamma = ', num2str(rad2deg(gamma(1,iGamma)))];
plot(handles.axes1,SA,Fy,'DisplayName',txt)
this because txt was a char of a different length while looping on iFile, iLoad, etc.
I'd like to migrate this to the App, but it looks like that 'DisplayName' is no longer a property supported by UIAxes (Graphics Support in App Designer - MATLAB & Simulink - MathWorks Deutschland)
And I cannot use legend, as the length is changing. Well, I could create the legend before, but I have 3 nested loops. Pretty ugly to see them twice. I'm sure there is a more clever way.
0 Comments
Accepted Answer
Walter Roberson
on 16 Jun 2021
Tested.
fig = uifigure();
ax = axes(fig);
h = plot(ax, rand(1,5), 'displayname', 'test');
legend(ax, 'show')
The key here is that 'DisplayName' is not an axes property: it is a Chart property.
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!