Wednesday, June 11, 2014

Creating Stack Bar Plot

Creating stack plot experiment in Matlab.
First count items in the range, then make distribution stack plot by month

for jj = 1:12
iwant = find(dates(:,2)==jj);
iPBL = []
iPBL = PBL(iwant);
PBL5(jj) = length(iPBL(iPBL<500));
PBL1(jj) = length(iPBL(iPBL<1000 &  iPBL>=500));
PBL15(jj) =length(iPBL(iPBL<1500 &  iPBL>=1000));
PBL2(jj)=length(iPBL(iPBL<2000 &  iPBL>=1500));
PBL25(jj) =length(  iPBL(iPBL>=2000));
end

 % Create a stacked bar chart using the bar function
figure;
bar([1:12], [PBL5; PBL1; PBL15; PBL2; PBL25]', 'stack');

% Add title and axis labels
title('PBL distribution by month');
xlabel('Month');
ylabel('PBL range count');

% Add a legend
legend('<.5', '.5\leqc<1', '1<c\leq1.5', '1.5<c\leq2', '2\leq c');

No comments: