title: Wrong legends when plotting histogram with `hold on`
body: <p>I am plotting histograms on a subplot, where each plot has two histograms as shown in one part of the subplot below:</p>
  
  <p><img src="https://i.stack.imgur.com/TT5hq.jpg" alt="enter image description here"></p>
  
  <p><strong>Question:</strong> I would want the hist with variable named <code>result_uT_per_window</code> to have red legend, and hist with variable named <code>uT_top_of_global_window</code> to have blue legend. I thought what I have in code is supposed to do that, but it doesn't. This is the code:</p>
  
  <pre><code>    hold on
      hist(nonzeros(result_uT_per_window(:,window_no)))
      hist(uT_top_of_global_window)
      h = findobj(gca, 'Type','patch');
      set(h(1), 'FaceColor','r', 'EdgeColor','w')
      set(h(2), 'FaceColor','b', 'EdgeColor','w')
      xlabel('Total Velocity (in m/s)')
      ylabel('Frequency')
      legend('From moving window','From global window')
  </code></pre>
  
  <p>Can you notice where am I going wrong? Thanks.</p>