xsize=10
ysize=8
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=-70000
xmx=70000
xticks=20000
xsubticks=10000
ymn=-0.25
ymx=0.25
yticks=0.1
ysubticks=0.05

pi=3.1415926535897932

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{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
ms=4*pt

! some constants
emutomuBfuLi=3.31
emutomuBfuNa=2.969990096

begin graph
 size xsize ysize
 scale auto
 nobox
  
 data Ba2LiOsO6-6.dc.dat d1=c2,c4 d2=c2,c5 ! Li M(B)
 data BNOO-3.dc.dat d3=c2,c4 d4=c2,c5 ! Na M(B)
 let d1=d1*emutomuBfuLi
 let d2=d2*emutomuBfuLi
 let d3=d3*emutomuBfuNa
 let d4=d4*emutomuBfuNa
  
 xtitle "\tex{$B$ (\si{\tesla})}"
 xaxis min xmn max xmx dticks xticks dsubticks xsubticks
 !xaxis format "round 1 prepend \tex{$ append $}"
 xticks length tt
 xaxis min xmn max xmx! dsubticks 10000
 xplaces -60000 -40000 -20000 0 20000 40000 60000
 xnames \tex{$-6$} \tex{$-4$} \tex{$-2$} \tex{$0$} \tex{$2$} \tex{$4$} \tex{$6$}
 
 ytitle "\tex{$M$ ($\mu _{\mathrm{B}}$/f.u.)}" dist 0.05
 yaxis min ymn max ymx dticks yticks dsubticks ysubticks
 yaxis format "round 1 prepend \tex{$ append $}"
 yticks length tt
 
 d1 color rgb(0.196078431,0,0.376470588) marker wcircle msize ms err d2  ! Li dark purple
 d3 color rgb(0.584314,0.223529,0.898039) marker fsquare msize ms/1.5 err d4  ! Na light purple
end graph

! Ba2LiOsO6 hysteresis arrows/label
set color rgb(0.196078431,0,0.376470588)
arrowlen=1
amove 1.9 3.34
arrowangle=30/180*pi
rline arrowlen*sin(arrowangle) arrowlen*cos(arrowangle) arrow start
amove 3 3.1
arrowangle=30/180*pi
rline arrowlen*sin(arrowangle) arrowlen*cos(arrowangle) arrow end
amove 7.9 5.3
arrowangle=30/180*pi
rline arrowlen*sin(arrowangle) arrowlen*cos(arrowangle) arrow start
amove 9.2 5.1
arrowangle=30/180*pi
rline arrowlen*sin(arrowangle) arrowlen*cos(arrowangle) arrow end

amove 3.2 4.85
begin rotate 4.5
 text \tex{Ba$_2$LiOsO$_6$}
end rotate

! Ba2NaOsO6 label
set color rgb(0.584314,0.223529,0.898039)
amove 7.2 7.2
begin rotate 5.5
 text \tex{Ba$_2$NaOsO$_6$}
end rotate