Effacer les filtres
Effacer les filtres

Problem with legends for multiple entries

2 vues (au cours des 30 derniers jours)
Aftab Ahmed Khan
Aftab Ahmed Khan le 28 Juin 2016
Commenté : Aftab Ahmed Khan le 28 Juin 2016
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);

Réponse acceptée

José-Luis
José-Luis le 28 Juin 2016
legend(h(4),{'your legend'})
  3 commentaires
José-Luis
José-Luis le 28 Juin 2016
Modifié(e) : José-Luis le 28 Juin 2016
legend(h(4),{'some legend'})
etc...
Perhaps you meant instead:
legend(h(1),{'first group', 'second group', 'third group'})
Please read the legend() documentation.
Aftab Ahmed Khan
Aftab Ahmed Khan le 28 Juin 2016
Thank you. Done.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by