Is any change 'DisplayName' property in plot function?
Show older comments
plot(x,y,'DisplayName',{'name1','name2','name3','name4'})
produce error
Error using plot
Value must be a string.
This shall produce this plot with curve names.

Is any change in 'DisplayName' property in plot function?
1 Comment
Baptiste Contour
on 26 Jun 2020
Edited: Baptiste Contour
on 26 Jun 2020
Using 2020a
Names need to be a char:
plot(magic(4),'DisplayName',char({'name1','name2','name3','name4'}))
You still need to specify a minimum the legend afterwards to display it, eg:
legend('location', 'best');
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Programming 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!