Thursday, December 22, 2011

Multi-language support of gnuplot --- Using latex (2)

We have shown how to get multi-language support by using latex in the former posts. It works, but a little complicated --- You need to take two steps to get the final graph. In practice, it can be simplified by using an option of the (*)latex terminal. This option is "header". You can put the package use and other commands after this option, and then the generated tex file will contain these information at the header part. So you need not to modify the tex file manually. You get the final graph at one step.

So try the following plot script. Run it and compile the output tex file using latex, and at once you a Chinese supported graph.

reset
set term epslatex color standalone header \
"\\usepackage{CJK}\n \
\\AtBeginDocument{\\begin{CJK*}{GBK}{song}} \
\\AtEndDocument{\\end{CJK*}}"

set output "voltage.tex"

set xlabel "时间(秒)"
set ylabel "电压(伏)"
unset key
plot sin(x)+0.1*(2*rand(0)-1.) w l lw 2
set output 

Gnuplot plotted graph with Chinese support

No comments:

Post a Comment

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.