Search this blog!

Showing posts with label multiple legend. Show all posts
Showing posts with label multiple legend. Show all posts

Thursday, July 5, 2012

Multiple Legend in plot/subplot

I needed multiple legend on a plot for multiple data where data sizes were different. If try classical legend you get the following


    figure
  p1=plot(I_test(:,:,1),I_true(:,:,1),'r.');
  hold on
  p2=plot(RGB_test(:,1),RGB_ref(:,1),'g.');
    legend( 'true','calculated');
It does not give what I want !! Therefore.....continue reading..


Instead try the following to have different legend

 figure
  p1=plot(I_test(:,:,1),I_true(:,:,1),'r.');
  hold on
  p2=plot(RGB_test(:,1),RGB_ref(:,1),'g.');
  legend([p1(1) p2(end)], 'true','calculated');