本文介绍了gnuplot中的epslatex没有给出正确的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下脚本生成简单的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.pssample1.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没有给出正确的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 20:19