필터 지우기
필터 지우기

Problem with legends for multiple entries

조회 수: 2 (최근 30일)
Aftab Ahmed Khan
Aftab Ahmed Khan 2016년 6월 28일
댓글: Aftab Ahmed Khan 2016년 6월 28일
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.
Aftab Ahmed Khan
Aftab Ahmed Khan 2016년 6월 28일
Thank you. Done.

댓글을 달려면 로그인하십시오.

추가 답변 (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