----------------------
function void write_boxplot (string ttitle,
string ylabel,
scalar ymin,
scalar ymax,
matrix Y)
string tmpfname = "
boxtmp.gp"
win = $windows
if win == 1
sprintf tmpfile "@dotdir\@tmpfname"
else
sprintf tmpfile "@dotdir/@tmpfname"
endif
set force_decpoint on
outfile "@tmpfile" --write
printf "set encoding utf8\n"
printf "set border 2 front linetype -1 linewidth 2.000\n"
printf "set boxwidth 0.5 absolute\n"
printf "set style fill solid 0.6 border lt -1\n"
#printf "set style fill empty border lt -2 \n"
printf "set nokey\n"
printf "set pointsize 0.5\n"
printf "set style boxplot outliers pointtype 7\n"
printf "set style data boxplot\n"
printf "set xzeroaxis lw 3 lt -1\n"
printf "set grid lw 5\n"
# printf "set xtics border in scale 0,0 nomirror norotate offset character 0, 0, 0 autojustify\n"
# printf "set xtics norangelimit\n"
printf "unset xtics\n"
#printf "set xtics ()\n"
#printf "set xtics nomirror\n"
#printf "set ytics border in scale 1,0.5 nomirror norotate offset character 0, 0, 0 autojustify font ',20'\n"
printf "set ytics nomirror font ',20'\n"
printf "set yrange [%.3f:%.3f]\n", ymin, ymax
printf "set title '@ttitle' font ',20'\n"
printf "set ylabel '@ylabel'\n"
printf "set datafile missing 'nan'\n"
printf "plot '-' using (1):2\n"
loop t=1..rows(Y) --quiet
printf "%d %g\n", t-1, Y[t]
endloop
printf "e\n"
outfile "@tmpfile" --close
printf "set force_decpoint off\n"
end function