2

I would like to add two legend in my y=exp(x) plot:

i.e.

x=1:1:10;
y=exp(x);
figure; bar(x,y,'FaceColor',[0 .5 .5],'EdgeColor',[0 .9 .9],'LineWidth',0.5);  hold on; grid on;

h_legend1=legend(strcat('info 1: ', num2str(value 1),'info 2:', num2str(value 2),'%') ,'Location','best');
    set(h_legend1,'FontSize',12); hold on;

h_legend2=legend(strcat('info 1: ', num2str(value 1),'info 2:', num2str(value 2),'%') ,'Location','best');
    set(h_legend1,'FontSize',12); hold on;

but I cant ... only the legend2 is plotted ... any idea is more than welcome enter code here

user1640255
  • 1,224
  • 3
  • 19
  • 25
  • Isn't it because the two handles are defined the same? Also you are always calling the first handle `h_legend1`, even in the second `set` statement – brodoll Nov 03 '15 at 18:02
  • 2
    @brodroll you cannot have more than one legend per axes object (without workarounds, of course) – sco1 Nov 03 '15 at 18:03
  • @excaza Thanks for the tip! I might just have expressed myself badly, I was just making observations on why only legend 2 is being plotted, besides the fundamental reason you already stated – brodoll Nov 03 '15 at 18:14

0 Answers0