%
%  subplots_four_linlin_four_titles.m  ver 1.2  by Tom Irvine
%

function[fig_num]=...
    subplots_four_linlin_four_titles(fig_num,xlabel3,...
                                     ylabel1,ylabel2,ylabel3,ylabel4,...
                                     data1,data2,data3,data4,...
                                     t_string1,t_string2,t_string3,t_string4)


hp=figure(fig_num);

subplot(4,1,1);
plot(data1(:,1),data1(:,2));
grid on;
ylabel(ylabel1);
title(t_string1);
yabs=max(abs(data1(:,2)));
[~,yTT,ytt,iflag]=ytick_linear_double_sided(yabs);

if(iflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    ylim([min(ytt),max(ytt)]);
end
x1 = xlim;


%
subplot(4,1,2);
plot(data2(:,1),data2(:,2));
grid on;
ylabel(ylabel2);
title(t_string2);
xlim([x1(1) x1(2)]);
yabs=max(abs(data2(:,2)));
[~,yTT,ytt,iflag]=ytick_linear_double_sided(yabs);

if(iflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    ylim([min(ytt),max(ytt)]);
end

%
subplot(4,1,3);
plot(data3(:,1),data3(:,2));
grid on;
ylabel(ylabel3);
title(t_string3);
xlim([x1(1) x1(2)]);
yabs=max(abs(data3(:,2)));
[~,yTT,ytt,iflag]=ytick_linear_double_sided(yabs);

if(iflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    ylim([min(ytt),max(ytt)]);
end

subplot(4,1,4);
plot(data4(:,1),data4(:,2));
grid on;
xlabel(xlabel3);
ylabel(ylabel4);
title(t_string4);
xlim([x1(1) x1(2)]);
yabs=max(abs(data4(:,2)));
[~,yTT,ytt,iflag]=ytick_linear_double_sided(yabs);

if(iflag==1)
    set(gca,'ytick',ytt);
    set(gca,'YTickLabel',yTT);
    ylim([min(ytt),max(ytt)]);
end

fig_num=fig_num+1;

set(hp, 'Position', [100 100 1100 800]);