function PlotFitParameterLon(DataFolder,location,filename,X1, Y1,Y1b,Y1c, Y2, Y3, Y4, Y5, Y6,X9,j,X10,n)
%SUBFUNCTION OF LonFit3_long and LonFit3_long_2; Plot fitting Parameters of the longitudal fit over all radar stations

%

%X1:  TimeLonVec.Time
%
%errorflag (blue)/ Number of iterations (black) / r^2 (red) 
%Y1:  TimeLonVec.Fit.errorflag
%Y1b: TimeLonVec.Fit.iter
%Y1c: TimeLonVec.Fit.gof.rsquare
%
%Anomaly meridional wind, S0
%Y2:  TimeLonVec.Fit.S0
%
%Amplitude anomaly meridional wind, S1
%Y3:  TimeLonVec.Fit.S1
%Phase Anomaly meridional wind, S1
%Y4:  TimeLonVec.Fit.c1
%Amplitude anomaly meridional wind, S2
%Y5:  TimeLonVec.Fit.S2
%Phase Anomaly meridional wind, S2
%Y6:  TimeLonVec.Fit.c2
% 
%X9:  TimeLonVec.Time(ind) (green) %Days with existing LonFit
%j:   size(ind,1) %Number of Days with existing LonFit


%X10: TimeLonVec.Time(indn) (red) %Days without existing LonFit
%n:   size(indn,1) %Number of Days without existing LonFit

%

% Create figure
figure1 = figure('NumberTitle','off','Name',strcat(location,'_FitParameter'),'units','centimeters','Position',[0 0 21 25],...                    % setter str på figuren du vil se på skjermen. VIKIT Gat units kommer FØR Position
    'PaperUnits','centimeters','PaperPosition', [0 0 21 25],...% setter str på figuren du vil lagre (uavhengig av format) VIKITG at units kommer FØR Position
    'DefaultAxesFontSize',12,'DefaultAxesFontWeight','b');               %setter str på font i figure 

% Create axes
axes1 = axes('Parent',figure1,...
    'YTickLabel',{'0','0.1','0,5','2','10','50'},...
    'YTick',[0 0.1 0.5 2 10 50],...
    'YScale','log',...
    'YMinorTick','on',...
    'Position',[0.13 0.800677966101695 0.334659090909091 0.124322033898305]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes1,[728800 729100]);
box(axes1,'on');
hold(axes1,'all');

% Create plot
plot(X1,Y1,'Parent',axes1,'Marker','.','LineStyle','none','Color','b');
hold on
plot(X1,Y1b,'Parent',axes1,'Marker','.','LineStyle','none','Color','k');
plot(X1,Y1c,'Parent',axes1,'Marker','.','LineStyle','none','Color','r');
datetick('x','yymmdd','keepticks');
% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('r^2/errorflag/# iterations');
hold off
% Create axes
axes2 = axes('Parent',figure1,...
    'Position',[0.570340909090909 0.800677966101695 0.334659090909091 0.124322033898305]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes2,[728800 729100]);
box(axes2,'on');
hold(axes2,'all');

% Create plot
plot(X1,Y2,'Parent',axes2,'Marker','.','LineStyle','none','Color','k');
datetick('x','yymmdd','keepticks');
% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('S_0');

% Create axes
axes3 = axes('Parent',figure1,...
    'Position',[0.13 0.618093460411965 0.334659090909091 0.124322033898305]);
   
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes3,[728800 729100]);
box(axes3,'on');
hold(axes3,'all');

% Create plot
plot(X1,Y3,'Parent',axes3,'Marker','.','LineStyle','none','Color','k');
datetick('x','yymmdd','keepticks');

% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('S_1');

% Create axes
axes4 = axes('Parent',figure1,...
   'Position',[0.570340909090909 0.618093460411965 0.334659090909091 0.124322033898305]);
    
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes4,[728800 729100]);
box(axes4,'on');
hold(axes4,'all');

% Create plot
plot(X1,Y4,'Parent',axes4,'Marker','.','LineStyle','none','Color','k');
datetick('x','yymmdd','keepticks');
% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('c_1');

% Create axes
axes5 = axes('Parent',figure1,...
    'Position',[0.13 0.441174677101839 0.334659090909091 0.124322033898305]);
    
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes5,[728800 729100]);
box(axes5,'on');
hold(axes5,'all');

% Create plot
plot(X1,Y5,'Parent',axes5,'Marker','.','LineStyle','none','Color','k');
datetick('x','yymmdd','keepticks');
% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('S_2');

% Create axes
axes6 = axes('Parent',figure1,...
    'Position',[0.570340909090909 0.439758246506938 0.334659090909091 0.124322033898305]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes6,[728800 729100]);
box(axes6,'on');
hold(axes6,'all');

% Create plot
plot(X1,Y6,'Parent',axes6,'Marker','.','LineStyle','none','Color','k');
datetick('x','yymmdd','keepticks');
% Create xlabel
xlabel('date [yymmdd]');

% Create ylabel
ylabel('c_2');



% Create axes
axes9 = axes('Parent',figure1,...
    'Position',[0.129032258064516 0.0628144455182313 0.792114695340502 0.0595336355604959]);
box(axes9,'on');
hold(axes9,'all');

plot(X9,ones(1,j)*0.1,'Parent',axes9,'Marker','.','LineStyle','none','Color','g');
hold on
plot(X10,ones(1,n)*(-0.1),'Parent',axes9,'Marker','.','LineStyle','none','Color','r');

datetick('x','yymmdd');

ylim([-1,1])
%xlim([min([X9,X10])-2,max([X9,X10])]+2)

% Create xlabel
xlabel('date [yymmdd]');

% Create title
title('Fit Coverage');

hold off


% Create textbox
annotation(figure1,'textbox',...
    [0.363007168458781 0.954674220963173 0.262440860215054 0.0198300283286133],...
    'Interpreter','none',...
    'String',{location},...
    'HorizontalAlignment','center',...
    'FontWeight','bold',...
    'FontSize',14,...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
if strcmp(filename,[location,'_Fit.fig'])
annotation(figure1,'textbox',...
    [0.0954524075966203 0.185552407932013 0.808243727598566 0.0198300283286133],...
    'String',{'a0+a1*sin(x*pi+c1) + a2*sin(2*x*pi+c2) + a3*sin(3*x*pi+c3); x[day]'},...
    'HorizontalAlignment','center',...
     'FontSize',12,...
    'FitBoxToText','off',...
    'LineStyle','none');
else
    annotation(figure1,'textbox',...
    [0.0954524075966203 0.185552407932013 0.808243727598566 0.0198300283286133],...
    'String',{'S0+S1*sin(2*Pi*lon/360+c1)+S2*sin(2*Pi*lon/180+c2); x[day]'},...
    'HorizontalAlignment','center',...
     'FontSize',12,...
    'FitBoxToText','off',...
    'LineStyle','none');
end

saveas(figure1,fullfile(DataFolder,location,filename),'fig')
makePDF(gca,[25,35],filename,fullfile(DataFolder,location))
end