%% plot functions
N = 100;
E = linspace(4e3,2e4,N);
c = linspace(4,75,N);
[X1,X2] = meshgrid(E,c);

% evaluate PCK
Y = uq_evalModel(my_PCK,[X1(:),X2(:)]);
Y1 = reshape(Y(:,1),size(X1,1),size(X1,2));
Y2 = reshape(Y(:,2),size(X1,1),size(X1,2));

% init
colorLimit = [min([Y1(:);Y2(:)]),max([Y1(:);Y2(:)])];
contourLevels = linspace(colorLimit(1),colorLimit(2),10);
postSample = reshape(permute(myBayes.Results.PostProc.PostSample,[2 1 3]),2,[]).';

%% plot surroagte model predicitons
uq_figure
hold on
contourf(X1,X2,Y1,contourLevels')
uq_plot(my_PCK.ExpDesign.X(:,1),my_PCK.ExpDesign.X(:,2),'kx')
uq_plot(postSample(:,1),postSample(:,2),'rx')
cb = colorbar;
cb.Label.String = '$y_1$';
cb.Label.Interpreter = 'latex';
cb.TickLabelInterpreter = 'latex';
xlabel('$E$','interpreter','latex')
ylabel('$c$','interpreter','latex')
set(gca,'FontSize',16,'ticklabelinterpreter','latex','CLim',colorLimit)
export_fig('Y1.png','-q101','-nocrop','-m4')

uq_figure
hold on
contourf(X1,X2,Y2,contourLevels)
uq_plot(my_PCK.ExpDesign.X(:,1),my_PCK.ExpDesign.X(:,2),'kx')
uq_plot(postSample(:,1),postSample(:,2),'rx')
cb = colorbar;
cb.Label.String = '$y_2$';
cb.Label.Interpreter = 'latex';
cb.TickLabelInterpreter = 'latex';
xlabel('$E$','interpreter','latex')
ylabel('$c$','interpreter','latex')
set(gca,'FontSize',16,'ticklabelinterpreter','latex','CLim',colorLimit)
export_fig('Y2.png','-q101','-nocrop','-m4')

%% plot posterior predictive
uq_postProcessInversion(myBayes, 'priorPredictive', 1e3)
uq_display(myBayes, 'predDist', true)
export_fig('predDist.png','-q101','-nocrop','-m4')