MATLAB Examples

alt_6e.m

Make a traditional plot to demo obscurity.

load barley

% Organize yield into arrays by variety and site
%  specific to this data arrangement.
nSite = length(SiteName);
nVariety = length(VarietyName);
Site = Site(1:nSite);
ncol = length(Yield)/nSite;
Variety = reshape(Variety,nSite,ncol);
Year = reshape(Year,nSite,ncol);
Yield = reshape(Yield,nSite,ncol);

% Needed to order the variety names
Variety = Variety(1,1:nVariety);
Year = [Year(1,1) Year(1,end)];

%  Select allowing for the reversed years.
Yield1 = Yield(:,1:nVariety);
Yield2 = Yield(:,nVariety+1:end);

for iPlot = 1:nVariety
    subplot(2,5,iPlot)
    thisYield1 = Yield1(:,iPlot);
    thisYield2 = Yield2(:,iPlot);
    bar([thisYield1 thisYield2],1)
    set(gca,'XLim',[0 nSite+1],'XTickLabel',[])
    title(VarietyName{Variety(iPlot)})
end
colormap(hot)