Legend for several matrix plots

32 次查看(过去 30 天)
Hi there,
I'm trying to add a legend for my figure but the legend dose not match the matrix colour.
this is my code
figure
plot(Leftdata ,'K');hold on ;plot(Rightdata,'r'); % the size of Leftdata and the right data are 10coulumns and 101 rows for each.
grid on
grid minor
legend('Left','Right');
Any Suggestion to figure this problem out!!!!
Your help is greatly appreciated :)
Thanks

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-6-3
编辑:KALYAN ACHARJYA 2019-6-4
Its not a single lines, its bunch of lines
#Edited
p1=plot(Leftdata,'K');
hold on ;
p2=plot(Rightdata,'r');
grid on
grid minor
legend([p1(1),p2(2)],'left data','right data')
  3 个评论
Amneh Alshawabka
Amneh Alshawabka 2019-6-3
I have tried your first reply, this one
legend([p1(1),p2(2)],'left data','right data'), It's worked very well :)
Thank you so much :)

请先登录,再进行评论。

更多回答(0 个)

类别

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