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.70 samplen 2.4
set key nobox
set multiplot


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=0.5
e=1
f=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 "L || [110]" font 'Arial,32'
set label 3 at graph 0.07,0.12 "x 1" font 'Arial,32'

unset xlabel

plot "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*a) w l lw 3.5 lc  'black' notitle '',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/Spectra_mode1_av_site1_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' title '= [110]',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/Spectra_mode1_av_site1_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' title '= [1~1{0.8-}0]'
     
#---------------------------------
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 'Arial,32'
unset xlabel
set ylabel 'Mn L_{2,3}-edge XMLD intensity' offset 0.20,0.0 font 'Arial,32'

plot "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_mcd_site2.dat" u ($1+p):($3*( 0.35)*a) w l lw 3.5 lc  'black' notitle '',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/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 'plus',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/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 '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.35,0.12 "x 0.5" font 'Arial,32'
set xtics 10 offset 0.0,0.0
set xtics nomirror
unset ylabel

plot "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_tot_mcd.dat" u ($1+p):($3*(-0.35)*b) w l lw 3.5 lc  'black' notitle '',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_tot_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' notitle 'total plus',\
     "data/site1_0.3_site2_0.5/MLD/Pol_90_0/c_axis/XAS.dat/case2/xas_tot_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' notitle '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'
set label 1 at graph 0.35,0.85 "Mn1 ({/Symbol m}_z=0.5{/Symbol m}_B)" font 'Arial,32' 
set label 2 at graph 0.27,1.15 "L || [~1{0.8-}00]" font 'Arial,32'
set label 3 at graph 0.07,0.12 "x 1" font 'Arial,32'
unset xlabel
unset ylabel

plot "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site1.dat" u ($1+p):($3*(-0.35)*e) w l lw 3.5 lc  'black' notitle '',\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/Spectra_mode1_av_site1_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' title "= [010]",\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/Spectra_mode1_av_site1_M.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'blue' title "= [100]"

#---------------------------------
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'
set label 1 at graph 0.35,0.85 "Mn2 ({/Symbol m}_z=0.5{/Symbol m}_B)" font 'Arial,32'
unset label 2
unset xlabel

plot "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e) w filledc below y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e) w filledc above y=0.0 lc rgb "gray" notitle,\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/xas_mcd_site2.dat" u ($1+p):($3*(-0.35)*e) w l lw 3.5 lc  'black' notitle '',\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/Spectra_mode1_av_site2_P.dat" u ($1+p):($3*(-0.35)) w l lw 3.5 lc  'red' notitle,\
     "data/site1_0.5_site2_0.5/correct_site1_0.5_site2_0.5_MF_010/MLD/Pol_45_135/c_axis/XAS.dat/case3/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.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 1" font 'Arial,32'
set xlabel 'Energy (eV)'      offset -15.0, 0.0 font 'Arial,32'

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

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

unset multiplot