fillyrs.m (431B)
1 % fillyrs.m []=fillyrs(years,c); 2 % 3 % Shades "recessions" in a plot of a time series. Years is a Tx2 matrix 4 % that contains a series of recessions to be shaded using color c. 5 6 function []=fillyrs(years,c); 7 8 T=size(years,1); 9 ylim=get(gca,'YLim'); % Get Y range 10 for i=1:T; 11 x=[years(i,1) years(i,1) years(i,2) years(i,2)]; 12 y=[ylim(1) ylim(2) ylim(2) ylim(1)]; 13 h=patch(x,y,c); 14 set(h,'EdgeColor','none'); 15 end;