function PlotFitParameter2(DataFolder,location,filename,X1, Y1,Y1b,Y1c, Y2, Y3, Y4, Y5, Y6, Y7, Y8,Y9,Y10,X11,j,X12,n)
%SUBFUNCTION OF FitData; Plot fitting Parameters of the fit for Radar "location"

%

%X1:  Data.Fit.DaysWithFit
%
%errorflag (blue)/ Number of iterations (black) / r^2 (red) 
%Y1:  Data.Fit.errorflag
%Y1b: Data.Fit.iter
%Y1c: Data.Fit.gof.rsquare,...
%
%Mean meridional wind
%Y2:  Data.Fit.a0,...
%
%Amplitude 24h tide
%Y3:  Data.Fit.a1
%Phase 24h tide
%Y4:  Data.Fit.c1
%Amplitude 12h tide
%Y5:  Data.Fit.a2
%Phase 12h tide 
%Y6:  Data.Fit.c2
%Amplitude 8h tide
%Y7:  Data.Fit.a3
%Phase 8h tide
%Y8:  Data.Fit.c3
% 
%X9:  Data.Fit.DaysWithFit (green)
%j:   #Data.Fit.DaysWithFit
%X10: Data.Fit.DaysWithoutFit (red)
%n:   #Data.Fit.DaysWithoutFit
%
%

% Create figure
figure1 = figure('NumberTitle','off','Name',strcat(location,'_FitParameter'),'units','centimeters','Position',[0 0 21 27],...                    % setter str på figuren du vil se på skjermen. VIKIT Gat units kommer FØR Position
    'PaperUnits','centimeters','PaperPosition', [0 0 21 27],...% 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.85 0.334659090909091 0.1]);
% 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.85 0.334659090909091 0.1]);
% 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('a_0');

% Create axes
axes3 = axes('Parent',figure1,...
    'Position',[0.13 0.7 0.334659090909091 0.1]);
   
% 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('a_1');

% Create axes
axes4 = axes('Parent',figure1,...
   'Position',[0.570340909090909 0.7 0.334659090909091 0.1]);
    
% 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.55 0.334659090909091 0.1]);
    
% 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('a_2');

% Create axes
axes6 = axes('Parent',figure1,...
    'Position',[0.570340909090909 0.55 0.334659090909091 0.1]);
% 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
axes7 = axes('Parent',figure1,...
    'Position',[0.13 0.4 0.334659090909091 0.1]);
    
    
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes7,[728800 729100]);
box(axes7,'on');
hold(axes7,'all');

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

% Create ylabel
ylabel('a_3');

% Create axes
axes8 = axes('Parent',figure1,...
    'Position',[0.575462691430433 0.4 0.327252240696264 0.1]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes8,[728800 729100]);
box(axes8,'on');
hold(axes8,'all');

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

% Create ylabel
ylabel('c_3');


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

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

% Create ylabel
ylabel('a_4');

% Create axes
axes10 = axes('Parent',figure1,...
    'Position',[0.575462691430433 0.25 0.327252240696264 0.1]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes8,[728800 729100]);
box(axes10,'on');
hold(axes10,'all');

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

% Create ylabel
ylabel('c_4');

% Create axes
axes11 = axes('Parent',figure1,...
    'Position',[0.129032258064516 0.1 0.792114695340502 0.05]);
box(axes11,'on');
hold(axes11,'all');

plot(X11,ones(1,j)*0.1,'Parent',axes11,'Marker','.','LineStyle','none','Color','g');
hold on
plot(X12,ones(1,n)*(-0.1),'Parent',axes11,'Marker','.','LineStyle','none','Color','r');

datetick('x','yymmdd');

ylim([-1,1])
xlim([min([X11,X12])-2,max([X11,X12])]+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],...
    'String',{location},...
    'HorizontalAlignment','center',...
    'FontWeight','bold',...
    'FontSize',14,...
    'FitBoxToText','off',...
    'LineStyle','none');

% Create textbox
if strcmp(filename,[location,'_Fit3.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(x/2*pi+c3) + a4*sin(3*x*pi+c4); x[day]'},...
    'HorizontalAlignment','center',...
     'FontSize',12,...
    'FitBoxToText','off',...
    'LineStyle','none');
else
    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(x/2*pi+c3); x[day]'},...
    'HorizontalAlignment','center',...
     'FontSize',12,...
    'FitBoxToText','off',...
    'LineStyle','none');
end

saveas(figure1,fullfile(DataFolder,location,[filename]))

end