In the gnuplot script (or environment), after command plot, run:
call 'path/plottexpdf' 'figure_name'where the script plottexpdf is
set terminal epslatex standalone color colortextThe last line just put figure_name to a file, for post processing shell script to refer to. The result is a .tex file, which can be compiled using latex or pdflatex to get the desired figure.
set termoption enhanced
set out "$0.tex"
replot
set term pop
! echo $0 > /tmp/plottexpdf.name
However, it is quite boring to compile and post process each time. Thus I wrote a shell script to do it. Instead of run "gnuplot name.gp", I run "plot name.gp", with a shell script plot as follows:
Note that the sed "s/.../.../g" is a single line. If you copy / paste, it may be broken into two lines. Fix that if you need.gnuplot $1
FN=$(cat /tmp/plottexpdf.name)
# modify the length of the dashed line
sed "s/\/LT\([0-9]\) {PL \[4 dl1 2 dl2\] LC1 DL} def/\/LT\1 {PL \[7 dl1 3 dl2\] LC1 DL} def/g" $FN-inc.eps > $FN-inc.eps.tmp
cp $FN-inc.eps.tmp $FN-inc.eps
# pdflatex $FN.tex
latex $FN.tex
dvipdfm $FN.dvi
rm -f $FN.dvi
rm -f $FN.log
rm -f $FN.aux
rm -f $FN-inc.eps.tmp
/usr/bin/pdfcrop $FN.pdf $FN.pdf
No comments:
Post a Comment