#!/bin/bash foamLog log.simpleFoam >/dev/null gnuplot -persist > /dev/null 2>&1 << EOF set logscale y set title "Residual vs. Iteration" set xlabel "Iteration" set ylabel "Residual" plot "logs/Ux_0" with lines,\ "logs/p_0" with lines EOF
Nice post. I was reading Gnuplot in action and I came across a nice addition to the shell script to save plots in a given format.
#!/bin/bash
foamLog log.simpleFoam >/dev/null
gnuplot -persist > /dev/null 2>&1 << EOF set logscale y set title "Residual vs. Iteration" set xlabel "Iteration" set ylabel "Residual" plot "logs/Ux_0" with lines,\ "logs/p_0" with lines
call "save_plot" "output_filename" "size 1600,900" # size is an argument and is optional
EOF
save_plot file contains the following lines:
set terminal push set terminal pngcairo $1 set output "$0.png" replot set output set terminal pop
Nice post. I was reading Gnuplot in action and I came across a nice addition to the shell script to save plots in a given format.
ReplyDelete#!/bin/bash
foamLog log.simpleFoam >/dev/null
gnuplot -persist > /dev/null 2>&1 << EOF
set logscale y
set title "Residual vs. Iteration"
set xlabel "Iteration"
set ylabel "Residual"
plot "logs/Ux_0" with lines,\
"logs/p_0" with lines
call "save_plot" "output_filename" "size 1600,900" # size is an argument and is optional
EOF
save_plot file contains the following lines:
set terminal push
set terminal pngcairo $1
set output "$0.png"
replot
set output
set terminal pop
Thanks for reading and for that useful script!
DeleteI like your blog, by the way :)
Welcome. I'm glad that you liked my blog. I think my blog is plain weird. :D
Delete