Here is the IRFplot function I wrote it works badly when pdf is replaced by png, but gives this error when the pdf terminal is used:
 
Couldn't recognize the image file format for file 'C:\Users\w3071048\AppData\Roaming\gretl\gretltmp.png'
 
function void IRFplot(matrix response, string graph_title, string output_file)
 
## Plot IRF's
 
#Make temporary file name. This file stores GNUPLOT script
scalar tmpfname = int(1000*muniform(1,1))
h = rows(response)
if $windows
    sprintf tmpfile "@dotdir\\irf%d.gp", tmpfname
else
    sprintf tmpfile "@dotdir/irf%d.gp", tmpfname
endif
 
outfile "@tmpfile" --write
printf "set term pdf font \"Sans,5\" size 275,200\n"
printf "set encoding utf8\n"
printf "set style line 1 lc rgb \"#ff0000\"\n"
printf "set style line 2 lc rgb \"#0000ff\"\n"
printf "set style line 3 lc rgb \"#00cc00\"\n"
printf "set style line 4 lc rgb \"#bf25b2\"\n"
printf "set style line 5 lc rgb \"#8faab3\"\n"
printf "set style line 6 lc rgb \"#ffa500\"\n"
printf "set style line 8 lc rgb \"#dddddd\"\n"
printf "set style increment user\n"
printf "set key left top\n"
printf "set xlabel 'periods'\n"
printf "set xzeroaxis\n"
printf "set title '@graph_title'\n"
printf "plot '-' using 1:2:3 notitle w filledcurve lt 8, 0 notitle w lines lt 0, '-' using 1:2 notitle w lines lt 1\n"
 
loop for i=1..h -q
    printf "%d\t%g\t%g\n", i, response[i,2], response[i,3]
endloop
printf "e\n"
loop for i=1..h -q
    printf "%d\t%g\n", i, response[i,1]
endloop
printf "e\n"
outfile "@tmpfile" --close
gnuplot --input="@tmpfile" --output=display
gnuplot --input="@tmpfile" --output="@output_file"
end function