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

1 回表示 (過去 30 日間)
Osh
Osh 2016 年 4 月 29 日
コメント済み: Osh 2016 年 4 月 29 日
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)...
)
  1 件のコメント
Osh
Osh 2016 年 4 月 29 日
It doesn't show the extra markers / data point labels I need to highlight in the plot

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by