function []=plotMuSlip(slip, fric_coeff, expName, slip_maxDyn, fric_coeffRunIn)
% plot fric coeff vs slip with the values of muDyn and muStat as picked

expName = split(expName,'/');
expName = expName{3};
fileName = strcat('../3_Figures/Fig_MuSlip_',expName,'.pdf');

% def font and font size
fontSize = 14;

% create figure
Fig_muSlip = figure;

% set default fig prop
set(gcf,'DefaultAxesFontSize',fontSize);
set(gcf,'DefaultTextFontSize',fontSize);
set(gcf,'defaulttextinterpreter','latex')
set(gcf, 'defaultAxesTickLabelInterpreter','latex')
set(gcf, 'defaultLegendInterpreter','latex')

% set default props
set(gcf,'Units','Centimeters');  % unit used to by matlab, otherwise its pixel or stuff
outBoxPos = [5 5 18 7.5]; % to make values accessible for saving
set(gcf,'Position',outBoxPos); % Position on screen and dimensions of outer box
set(gcf,'PaperPositionMode','auto'); % preserve fig aspect ratio when saving to file
set(gcf,'Resize','Off'); % makes fig on screen to be not resizable, 'On' otherwise

% plots a line for the moment - dry
A = plot(slip/1000, fric_coeff,'k'); hold on;
B = plot([200 1700]/1000, [fric_coeffRunIn(1) fric_coeffRunIn(1)], '-','LineWidth',1.2,'Color','b');
C = plot([(slip_maxDyn-1500) slip_maxDyn]/1000, [fric_coeffRunIn(3) fric_coeffRunIn(3)],'-','LineWidth',1.2,'Color','c');

L=[A, B, C];
leg=legend(L, '$\mu^*$', '$\mu_\mathrm{s}^*$','$\mu_\mathrm{d}^*$');
legend boxoff          % removes the box around the legend
set(leg,'fontsize',fontSize) % set fontsize
set(leg,'Color',[1 1 1]);   % set colour of legend
set(leg,'Units','centimeters'); % choose some units for later
% set(leg,'DataAspectRatio',[1 1 1]);  % was originally commented out
set(leg,'Position',[15.2    1.8   3    1]); % places the legend as [left bottom width height]

% set axis pos and props
ax1=gca; % get handle to modify props
set(gca,'Units','centimeters');
set(gca,'Position',[ 1.4   1.3    16.5  6]); % Position and dimension in outer box

% set location of axis, top/bottom, left/right
set(ax1,'XAxisLocation','bottom');
set(ax1,'YAxisLocation','left');

% set axis limits
% xLim = max(slip);
axis([0 18.5 0 .75])
X=get(ax1,'XLim'); Y=get(gca,'YLim'); % store x and y limits of axes in X,Y
set(ax1,'xtick',0:2:20)             % where
ax1.XMinorTick = 'on';

ytickformat(ax1, '%.1f');                         % make last decimal zero to appear
set(ax1,'ytick',0:0.1:Y(2));
ax1.YMinorTick = 'on';

set(gca,'box','off')            % plot no box around figure
set(gca,'XColor',[0 0 0])       % set color of lower axis
set(gca,'YColor',[0 0 0])       % set color of y-axis

% label the axes
YL=ylabel('Apparent Friction, $\mu^*$ [-]'); %$\frac{\tau}{\sigma_\mathrm{n}}$');
set(YL,'Units','centimeters');
set(YL,'HorizontalAlignment','center');
set(YL,'VerticalAlignment','Middle');
set(YL,'Position',[-1.1 3  0]);        % pos relative to axis [horiz. vert ??]
XL=xlabel('Slip, $\delta$ [mm]');
set(XL,'Units','centimeters');
set(XL,'HorizontalAlignment','center');
set(XL,'VerticalAlignment','Middle');
set(XL,'Position',[8.25 -1 0]);

% % display some additional information
% someText = 'h321: K708, dry';
% TT=text(.5*X(2),0.6*Y(2),someText); % 1*X(1)
% % set(TT,'FontName',fontName);
% set(TT,'FontSize',fontSize);

fig=gcf;
% set(fig, 'PaperUnits', 'Centimeters');
% set(fig, 'PaperSize', 1.01*outBoxPos(3:4))
% set(fig, 'PaperOrientation', 'Portrait');
% set(fig, 'PaperPosition', [0, 0, outBoxPos(3:4)]);
% set(fig, 'PaperPositionMode','auto');
set(gcf,'Resize','Off');

set(Fig_muSlip, 'color', 'white')
set(gca, 'Box', 'on' );
% save figure to pdf
% exportgraphics(fig,fileName,"Resolution",300)