Placing Markers at Every Tenth Data Point and creating Label
13 views (last 30 days)
Show older comments
I understand that in order to place markers at every tenth data point I have to plot the data twice, e.g.,
x1 = 0:pi/100:2*pi;
x2 = 0:pi/10:2*pi;
plot(x1,sin(x1),'r:',x2,sin(x2),'r+')
But how do I create a label that would display both?
Thank you!
1 Comment
dpb
on 23 Sep 2014
What, specifically, do you mean by a label that would display both?
Have you tried
legend('A','B')
Accepted Answer
Kelly Kearney
on 23 Sep 2014
If by label you mean a legend entry, I'd add a dummy line to use for labeling
x = 0:pi/100:2*pi;
y = sin(x);
h = plot(x, y, ':r', x(1:10:end), y(1:10:end), 'r+', NaN, NaN, ':r+');
legend(h(3), 'my label');
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!