Problem with legends for multiple entries

1 次查看(过去 30 天)
Hello everyone, I am plotting different entities on the figure window. The problem is when i use the legend function, it doesn't work and give me an error. All the plot function works fine as shown in the figure. The way i am doing it is like this,
[axuser,ayuser]=userdistribution();
figure(1);
hold on;
h(1)=plot(axuser,ayuser,'yo','MarkerSize',3,'MarkerFaceColor',[0.5,0.5,0.5],'DisplayName','Users');
%Layout the ABSs in the coverage area using square topology
[absx,absy]=abslayout();
h(2)=plot(absx,absy,'rh','MarkerSize',10,'MarkerFaceColor',[1,0,0],'DisplayName','ABSs');
%Layout the CABSs in the coverage area.
[cabsx,cabsy]=cabslayout();
h(3)=plot(cabsx,cabsy,'k*','MarkerSize',10,'MarkerFaceColor',[0,0,1],'DisplayName','RBSs');
%Layout the HBSs in the coverage area.
[hbsx,hbsy]=hbslayout();
h(4)=plot(hbsx,hbsy,'b^','MarkerSize',12,'MarkerFaceColor',[0.2,0.2,1],'DisplayName','HBSs');
legend(h);

采纳的回答

José-Luis
José-Luis 2016-6-28
legend(h(4),{'your legend'})
  3 个评论
José-Luis
José-Luis 2016-6-28
编辑:José-Luis 2016-6-28
legend(h(4),{'some legend'})
etc...
Perhaps you meant instead:
legend(h(1),{'first group', 'second group', 'third group'})
Please read the legend() documentation.

请先登录,再进行评论。

更多回答(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