Display markers at given points for multiple lines and fixing legend entry
9 views (last 30 days)
Show older comments
I have the following basic example to illustrate a plot for three lines.
xaxis=[1 2 3 4]
p1=[56 57 58 62];
p2=[14 16 34 38]
p3=[22 24 28 31];
I would like to add a marker at the following data points in each of the 3 lines
xmarkers=[1 3 4];
ymarkers=[56 34 31];
plot(...
xaxis,p1,'o-',xmarkers(1),ymarkers(1),'k*',...
xaxis,p2,'o-',xmarkers(2),ymarkers(2),'k*',...
xaxis,p3,'o-',xmarkers(3),ymarkers(3),'k*'...
)
with the following legend entry:
legend('line plot 1','line plot 2','line plot 3','Location','Northwest')
How can I remove additional markers (*) point from the legend?
0 Comments
Answers (1)
KSSV
on 29 Apr 2016
plot(xaxis,p1,'o-',xmarkers(1),ymarkers(1),...
xaxis,p2,'o-',xmarkers(2),ymarkers(2),...
xaxis,p3,'o-',xmarkers(3),ymarkers(3)...
)
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!