%% Change Color and Transparency of Recession Bands
% Overlay recession bands on a plot of multiple time series. Return the handles of the recession bands so you can change their color and transparency.
% Load data on credit defaults, and extract the predictor variables in the first four columns.

load Data_CreditDefaults
X0 = Data(:,1:4);
T0 = size(X0,1);

%
% Convert dates to serial date numbers, and then plot the four time series.

dates = datenum([dates,ones(T0,2)]);

figure;
plot(dates,X0,'LineWidth',2);
ax = gca;
ax.XTick = dates(1:2:end);
datetick('x','yyyy','keepticks')
xlabel('Year');
ylabel('Level');
axis tight;

%
% Overlay recession bands, returning the handles to the bands. Change the band color to red and increase the transparency.

hBands = recessionplot;
set(hBands,'FaceColor','r','FaceAlpha',0.4)

% Copyright 2012 The MathWorks, Inc.