问题描述
我正在使用以下脚本来生成一个简单的 eps 图片:
I am using the following script to generate a simple eps image:
set terminal epslatex 8
set output 'sample1.tex'
set size 0.75,0.75
set xrange [-pi:pi]
set yrange [0:1.2]
set xlabel "$x$"
set ylabel "$y$"
plot sin(x)*sin(x) title "$\sin^2(x)$"
但是,当我在 gnuplot 中运行它时
However, when I run it in gnuplot
gnuplot> load "sample.gpi"
我得到一个空白图像,只显示没有数字的网格.有什么建议我做错了吗?
I got a blank image, just the grids without numbers are shown.Any suggestion what I'm doing wrong?
推荐答案
您可能正在查看 sample1-inc.eps
文件.但是您必须先编译输出 LaTeX 文件.为此,使用 standalone
选项并从脚本本身编译非常方便:
You are probably viewing the sample1-inc.eps
file. But you must compile the output LaTeX-file first. For this it is very convenient to use the standalone
option and compile from within the script itself:
set terminal epslatex 8 standalone
set output 'sample1.tex'
set size 0.75,0.75
set xrange [-pi:pi]
set yrange [0:1.2]
set xlabel "$x$"
set ylabel "$y$"
plot sin(x)*sin(x) title "$\sin^2(x)$"
set output # finish the current output file
system('latex sample1.tex && dvips sample1.dvi && ps2pdf sample1.ps')
现在您可以load 'sample1.gpi'
并以sample1.ps
或sample1.pdf
形式查看完整的输出.如果您在 Windows 上,您可能需要使用三个单独的 system
调用进行编译(只是猜测):
Now you can load 'sample1.gpi'
and view the complete output as sample1.ps
or sample1.pdf
. If you are on Windows you may need to compile with three separate system
calls (just guessing):
system('latex sample1.tex')
system('dvips sample1.dvi')
system('ps2pdf sample1.ps')
这篇关于gnuplot 中的 epslatex 没有给出正确的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!