I am plotting histograms on a subplot, where each plot has two histograms as shown in one part of the subplot below:
Question: I would want the hist with variable named result_uT_per_window
to have red legend, and hist with variable named uT_top_of_global_window
to have blue legend. I thought what I have in code is supposed to do that, but it doesn't. This is the 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')
Can you notice where am I going wrong? Thanks.