Display markers at given points for multiple lines and fixing legend entry

2 次查看(过去 30 天)
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?

回答(1 个)

KSSV
KSSV 2016-4-29
plot(xaxis,p1,'o-',xmarkers(1),ymarkers(1),...
xaxis,p2,'o-',xmarkers(2),ymarkers(2),...
xaxis,p3,'o-',xmarkers(3),ymarkers(3)...
)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by