is it a bug?
Show older comments
The code below
(i) does not produce an error message about not matching x and y; it can be explained by implicit expansion in plot();
(ii) produces 100 legends; this I cannot explain.
x=1:100;
y=1;
plot(x,y,'DisplayName','a bug'),
legend('-DynamicLegend'),
Accepted Answer
More Answers (1)
Bruno Luong
on 11 Sep 2019
Edited: Bruno Luong
on 11 Sep 2019
1 vote
No it's not a bug: from PLOT doc
- If one of X or Y is a scalar and the other is either a scalar or a vector, then the plot function plots discrete points. However, to see the points you must specify a marker symbol, for example, plot(X,Y,'o').
You get really 100 points plotted.
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!