clear;
clc;
close all;

addpath("data")
%% Motivational Chart; Figure 1

% Load MCMC results
load('data_for_server_20250429_PCEx.mat')
ids_1 = 1:find(dates_=='01-Oct-1989');
ids_2 = find(dates_=='01-Jan-1990'):size(dates_,1);

y1 = y(ids_1);
y2 = y(ids_2);

FigH = figure('Position', get(0, 'Screensize'));
hold on; 
h1 = histfit(y1,[],'kernel');
h1(1).FaceColor = 'blue';
h1(1).FaceAlpha = 0.5;
h1(2).Color = 'blue';
% Set renderer to 'painters' for vector output (PDF/EPS)
h2 = histfit(y2,[],'kernel','FaceColor','red');
h2(1).FaceColor = 'red';
h2(1).FaceAlpha = 0.5;
h2(2).Color = 'red';
ax = gca();
% Resize figure for publication (e.g., 16 cm wide × 8 cm tall)
set(gcf, 'Units', 'centimeters', 'Position', [2, 2, 16, 8]);
% Set renderer to 'painters' for vector output (PDF/EPS)
set(gcf, 'Renderer', 'painters');
legend('1974Q2 to 1989Q4',"",'1990Q1 to 2024Q4')
%ax.FontSize = 20;
print(gcf, 'figures/OS_Figure2_pdf_comparison_motivation.pdf', '-dpdf', '-painters');
set(gcf,'PaperPositionMode','auto');
print(gcf, "figures/OS_Figure2_pdf_comparison_motivation.eps", '-depsc', '-painters','-loose');
    


