set terminal qt font "Arial,23" size 1200,1300 dashed enhanced
#set terminal qt font "Arial,28" size 1000,1200 dashed enhanced

set colors classic
set key box lw 2.5 font "Arial,28" maxrow 4 at graph 0.98, 0.95 samplen 2.4
set key nobox
set multiplot

unset key

set rmargin 0 ; set lmargin 0 ; set tmargin 0 ; set bmargin 0

set xrange[636:656]
set mxtics 5

set border linewidth 3.5
unset ylabel

a=1
b=2
c=2
d=2
e=2
f=2
m=1
p=642.76
#---------------------------------
set size   0.44, 0.28
set origin 0.10, 0.65

set yrange[-0.4:1.1]
set ytics  1 offset 0.0,0.0
set mytics 10
set ytics nomirror
set noxtics
set format x "%2.0f"

set label 1 at graph 0.35,0.85 "Mn1 ({/Symbol m}_z=0.3{/Symbol m}_B)" font 'Arial,32'
set label 2 at graph 0.27,1.15 "k_{in} || [110]" font 'Arial,32'
set label 3 at graph 0.07,0.12 "x 1" font 'Arial,32'

unset xlabel

plot "data/mirror_110/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a*m) w l lw 3.5 lc  'black' notitle '',\
     "data/mirror_110/XAS.dat/case2/Spectra_mode1_av_site2_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' title 'plus',\
     "data/mirror_110/XAS.dat/case2/Spectra_mode1_av_site2_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' title 'minus'
     
#---------------------------------
set size   0.44, 0.28
set origin 0.10, 0.37
set noxtics
set label 1 at graph 0.35,0.85 "Mn2 ({/Symbol m}_z=0.5{/Symbol m}_B)" font 'Arial,32'
unset label 2
set label 3 at graph 0.07,0.12 "x   − 1" font 'Arial32'
unset xlabel
set ylabel 'Mn L_{2,3}-edge XMCD intensity' offset 0.20,0.0 font 'Arial,32'

plot "data/mirror_110/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a*m) w l lw 3.5 lc  'black' notitle '',\
     "data/mirror_110/XAS.dat/case2/Spectra_mode1_av_site1_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' title 'plus',\
     "data/mirror_110/XAS.dat/case2/Spectra_mode1_av_site1_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' title 'minus'
#---------------------------------
set size   0.44, 0.28
set origin 0.10, 0.09

set label 1 at graph 0.70,0.80 "Total" font 'Arial,32'
unset label 2
set label 3 at graph 0.07,0.12 "x 2" font 'Arial,32'
set xtics 10 offset 0.0,0.0
set xtics nomirror
unset ylabel

plot "data/mirror_110/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/mirror_110/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b*m) w l lw 3.5 lc  'black' notitle '',\
     "data/mirror_110/XAS.dat/case2/xas_tot_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' title 'total plus',\
     "data/mirror_110/XAS.dat/case2/xas_tot_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' title 'total minus'

#---------------------------------
set size   0.44, 0.28
set origin 0.54, 0.65
set noxtics
set noytics
#set label 1 at graph 0.05,0.90 "site1" font 'Arial,32'
unset label 1 
set label 2 at graph 0.27,1.15 "k_{in} || [001]" font 'Arial,32'
set label 3 at graph 0.07,0.12 "x 2" font 'Arial,32'
unset xlabel
unset ylabel

plot "data/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e*m) w l lw 3.5 lc  'black' notitle '',\
     "data/c_axis/XAS.dat/case2/Spectra_mode1_av_site2_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' notitle,\
     "data/c_axis/XAS.dat/case2/Spectra_mode1_av_site2_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' notitle

#---------------------------------
set size   0.44, 0.28
set origin 0.54, 0.37
set noxtics
set noytics
#set label 1 at graph 0.05,0.90 "site2" font 'Arial,32'
unset label 1
unset label 2
unset xlabel

plot "data/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e*m) w l lw 3.5 lc  'black' notitle '',\
     "data/c_axis/XAS.dat/case2/Spectra_mode1_av_site1_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' notitle,\
     "data/c_axis/XAS.dat/case2/Spectra_mode1_av_site1_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' notitle

#---------------------------------
set size   0.44, 0.28
set origin 0.54, 0.09

set xtics 10 offset 0.0,0.0
set xtics nomirror
set noytics
#set label 1 at graph 0.05,0.90 "total" font 'Arial,32'
unset label 1
unset label 2
set label 3 at graph 0.07,0.12 "x 2" font 'Arial,32'
set xlabel 'Energy (eV)'      offset -15.0, 0.0 font 'Arial,32'

plot "data/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*f*m) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*f*m) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*f*m) w l lw 3.5 lc  'black' notitle '',\
     "data/c_axis/XAS.dat/case2/xas_tot_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' notitle,\
     "data/c_axis/XAS.dat/case2/xas_tot_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' notitle

#---------------------------------

unset multiplot