gnuplot epslatex无法获得重复图 [英] gnuplot epslatex unable to get replot

查看:42
本文介绍了gnuplot epslatex无法获得重复图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在epslatex终端中使用 replot 时,我 replot 的所有内容都不会显示在最终输出中.

When I use replot in the epslatex terminal, anything I replot is not showing up in the final output.

reset session
set terminal epslatex size 5.0in,4in color colortext font ',10' standalone

set output 'plots.tex'

set size square

plot sin(x)
replot cos(x)

set output

当我使用并在同一行中绘图时,会得到正确的输出.

When I use , and plot in the same line, I get correct outputs.

reset session
set terminal epslatex size 5.0in,4in color colortext font ',10' standalone

set output 'plots.tex'

set size square

plot sin(x), cos(x)

set output

replot 非常方便,因为我可以使用 set 并更改设置.

replot is very convenient becuase I can use set and change settings.

我的问题是如何在LaTeX中打印的 gnuplot 中使用 replot .

My question is how to use replot in gnuplot that prints in LaTeX.

推荐答案

在gnuplot中,两个命令是不同的.使用 plot sin(x),然后使用 replot cos(x)绘制两个图:一个具有sin(x),另一个具有结果上一个绘图命令(即sin(x))和cos(x)的值.确实

In gnuplot both commands are different. Using plot sin(x) followed by replot cos(x) draws two plots: one with sin(x) and another one with the result of the previous plot command (ie sin(x)) and cos(x). Indeed

plot sin(x)
replot cos(x)

绝对等于

plot sin(x)
plot sin(x), cos(x)

如果显示"plots-inc.eps",或者将终端更改为pdf,则有两页,第一页包含sin(x)的图,第二页同时包含sin(x).

If you display the 'plots-inc.eps' or if you change the terminal to pdf, you have two pages, the first with the plot of sin(x) and the second with both.

plots.tex文件应该包含在某个tex源中,并且仅包含一个绘图..tex文件中绘制的实际函数是最后一个函数(具有sin(x)和cos(x)).此代码适用于dvi输出,如果使用 latex plots.tex (而不是 pdflatex plots.tex )对其进行格式化,并使用xdvi(或其他格式)查看.dvi文件),您可以验证是否同时存在具有两个功能的图.出于未知原因,使用pdflatex时,只会出现sin(x)(但两者都在.tex代码中,并且有cos(x)的图例).

The plots.tex file is supposed to be included in a some tex source and only contains one plot. The actual function that is plotted in the .tex file is the last one (with sin(x) and cos(x)). This code is adapted to dvi output and if you format it with latex plots.tex (and not pdflatex plots.tex) and view the .dvi file with xdvi (or whatever), you can verify that a plot with both functions is present. For unknown reasons, with pdflatex, only the sin(x) appears (but both are in the .tex code and there is the legend for cos(x)).

这是我在.dvi文件中得到的内容:

Here is what I get in the .dvi file:

我们可以对此dvi文件进行缩放.

We can do a zoom on this dvi file.

如果使用pdf终端,则将其与第二个图进行比较.

And compare it to the second plot if we use a pdf terminal.

如您所见,使用dvi文件时,图的渲染效果较差,而使用pdf输出时,功能更加平滑.

As you can see, the plot rendering is worse with the dvi file and the function is smoother with the pdf output.

我认为问题在于epslatex终端是一个非常老的驱动程序.它是90年代的默认设置,但是对于现代TeX引擎,几乎没有人使用它了,我不确定它是否会得到积极维护.

I think the problem is that the epslatex terminal is a very old driver. It was the default in the nineties, but with modern TeX engines, almost no one uses it anymore and I am not sure that it is actively maintained.

这可能可以解释以下问题:pdflatex的绘图不完整以及渲染质量较低.该驱动程序很可能从未真正适应过pdflatex或lualatex之类的引擎.

This probably explains the problems : the incomplete plot with pdflatex and the lower quality of the rendering. Most probably this driver has never really been adapted to engines like pdflatex or lualatex.

除非您绝对需要dvi,否则建议您切换到其他驱动程序.以pdf格式生成绘图,并使用 \ includegraphics 加载它们.绘图质量将得到提高,但是您还将获得 \ includegraphics 的所有灵活性,以调整大小,旋转,修剪或对绘图进行任何操作.

Unless you absolutely need dvi, I would suggest you to switch to another driver. Generate your plots as pdf and use \includegraphics to load them. The plot quality will be increased, but you will also gain all the flexibility of \includegraphics to resize, rotate, clip or do whatever you want to your plots.

请注意,pdf驱动程序每页将生成一个图,并且在您的初始代码中有两个图.您可以在 \ includegraphics 的'page ='选项中包含pdf的特定页面(即图),但是更简单的方法是为每个图选择不同的输出文件.

Please note that the pdf driver will generate one plot per page and with your initial code there are two plots. You can include a specific page (ie plot) of the pdf with the 'page=' option of \includegraphics, but the simpler is to select different output files per plot.

set output 'plots.pdf'
plot sin(x)
set output 'plots2.pdf'
replot cos(x)

这篇关于gnuplot epslatex无法获得重复图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆