xsize=11
ysize=13.5
size xsize ysize
pt=0.0352777778 ! 1 postscript point

fs=12*pt  !font size
tt=4*pt   !tick length
lw=0.5*pt !line width
glw=2*lw  !graph line width
ms=4*pt   !marker size

! graph settings
xmn=0
xmx=20
ymn=-2
ymx=2

xticks=5
xsubticks=1
yticks=1
ysubticks=0.5

xgraphsize=11
ygraphsize=8

set lwidth lw
set hei fs
set just tl

! funky LaTeX commands
begin texpreamble
    % set fonts used for text and maths to Palatino
    \usepackage{mathpazo}
    \renewcommand{\familydefault}{ppl}
    \usepackage{upgreek}
    %\usepackage[group-separator={,}]{siunitx}
    \usepackage{siunitx}
end texpreamble

! set the normal font to AvantGarde-Demi, which is really obviously
! different to Palatino, so you can spot it if you forget to wrap
! text in \tex{}
set font psagd

glw=2*lw


!displace colour plot upwards
ydisp=5.6

amove 1.65 1.2+ydisp
bitmap "converge-colourplot.png" 7.7 5.6

amove 0 ydisp
begin graph
 size xgraphsize ygraphsize
 nobox

 data "converge-averages.tsv" d1=c1,c2 d2=c1,c3
 let d1=d1*100
 let d2=d2*100 ! convert into %
 let d3=-d2

 xaxis min xmn max xmx dticks xticks dsubticks xsubticks
 xticks length tt
 xlabels off
 
 x2places 2.879411911 6.203504909 10.60784418 13.36504618 16.83890301 19.2757321
 x2names \tex{\num{100}} \tex{\num{1000}} \tex{\num{5000}} \tex{\num{10000}} \tex{\num{20000}} \tex{\num{30000}}
 x2subticks off
 x2title "\tex{$N_{\mathrm{dipoles}}$}" dist 0.3


 ytitle "\tex{$\frac{B(R)-B(R=43)}{B(R=43)}$ (\% )}"
 yaxis min ymn max ymx dticks yticks dsubticks ysubticks
 yaxis format "round 1 prepend \tex{$ append $}"
 yticks length tt
end graph

begin key
 nobox
 text \tex{(a)}
end key

rmove 9.8 1.2
bitmap "colourbar.png" 0.3 5.6
box 0.3 5.6

rmove 0.5 0
tex "$\frac{\sqrt{3}a}{2}$"
rmove 0.3 3
begin rotate 270
  tex "$r_{\upmu -\uparrow}$"
end rotate
rmove -0.3 2.4
tex "$0$"

amove 0 0
begin graph
 size xgraphsize ygraphsize
 nobox

 data "converge-averages.tsv" d1=c1,c2 d2=c1,c3
 let d1=d1*100
 let d2=d2*100 ! convert into %
 let d3=-d2

 xtitle "\tex{$R$ ($a$)}"
 xaxis min xmn max xmx dticks xticks dsubticks xsubticks
 xaxis format "fix 0 prepend \tex{$ append $}"
 xticks length tt

 ytitle "\tex{$\frac{B(R)-B(R=43)}{B(R=43)}$ (\% )}"
 yaxis min ymn max ymx dticks yticks dsubticks ysubticks nolast
 yaxis format "fix 0 prepend \tex{$ append $}"
 yticks length tt

 d1 steps lstyle 1 color rgb255(48,80,248)  lwidth 0.5*pt
 fill d2,d3 color rgb(0.8,0.8,0.8)
end graph

begin key
 nobox
 text \tex{(b)}
end key