load('Red.mat')
load('Blue.mat')
figure
hold on
t = tiledlayout(2,2,'TileSpacing','compact');
bgAx = axes(t,'XTick',[],'YTick',[],'Box','off');
bgAx.Layout.TileSpan = [2 2];
bgAx.YColor = 'w';
ax2 = axes(t);
ax2.Layout.Tile = 1;
x = ones(1, length(Blue));
plot(ax2,x,Blue, 'bx', 'MarkerSize', 3, 'LineWidth', 0.5)
yline(ax2,22,'--');
ax2.XAxis.Visible = 'off';
ax2.Box = 'off';
ax2.YAxis.Color = 'b';
ylim(ax2,[22 30])
ax3= axes(t);
ax3.Layout.Tile = 2;
ax3.Layout.TileSpan = [2 1];
yyaxis left
yticks([])
ax3.YAxis(1).Color = 'w';
yyaxis right
ax3.YAxis(2).Color = 'r';
hold on
x = 5 * ones(1, length(Red));
plot(x, Red, 'r+', 'MarkerSize', 3, 'LineWidth', 0.5);
plot(x, median(Red), 'rhexagram', 'MarkerSize', 20, 'LineWidth', 2)
ylabel('Total Fluorescence Intensity Change', 'Color', 'r')
xlim([4.9, 5.1]);
ax3.XTick = [5];
ax3.XTickLabels = {'FI Delta'};
ax1 = axes(t);
ax1.Layout.Tile = 3;
hold on
x = ones(1, length(Blue));
plot(ax1,x, Blue, 'bx', 'MarkerSize', 3, 'LineWidth', 0.5)
ax1.YAxis.Color = 'b';
plot(x, median(Blue), 'bhexagram', 'MarkerSize', 20, 'LineWidth', 2)
yline(ax1,0.5,'--');
ax1.Box = 'off';
ylim(ax1,[0 0.5])
% Link the axes
linkaxes([ax1 ax2], 'x')
ylabel(t,'Tau', 'Color', 'b') %Does not lie within the middle of the two despite axis linked
xlim([0.9, 1.1]);
ax = gca;
ax.XTick = [1];
ax.XTickLabels = {'Tau'};
xlabel(t, 'PC3 Alexa Stats')
hold off
fontsize(gcf, 16, "points")
drawnow
exportgraphics(gcf, 'AlexaPC3SpreadTau_FIDelta.png', 'Resolution', 600)