latex - matplotlib 中的 gnuplot epslatex 功能

标签 latex matplotlib gnuplot eps

我习惯于使用 gnuplot 绘制数据,因此我可以使用 epslatex 轻松地将图形放入 LaTeX 文档中。终端。例如:

file = "data.dat"

set terminal epslatex
set output "figure1.tex"

plot file

这样,生成了两个文件:一个 .eps文件,其中包含图形和一个 .tex文件,其中包含文本。这样做的最大好处是文本由 LaTeX 渲染 ,因此抽动、标签等与文档的其余部分具有相同的字体。

现在我开始使用 matplotlib,它有一个更好的 API,更具脚本性,而且是 Python。但是,即使我可以让 matplotlib 使用 LaTeX 渲染文本,它也会嵌入到图像中,而且我无法获得与 gnuplot 相同的优势。

有什么办法可以在 matplotlib 中模拟 epslatex 终端吗?

最佳答案

更新 :matplotlib 1.2 introduced a new PGF/TikZ backend ,并且我已经成功地将它用于这个问题中所述的确切目的:使 LaTeX/XeTeX 渲染图的文本。在文档中有一些很好的例子 plotting using the PGF backend ,包括自定义序言、自定义字体和完整的 unicode 数学支持。

关于latex - matplotlib 中的 gnuplot epslatex 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6198254/

相关文章:

Xelatex 编译器出现 Latex 运行时错误

python - Ipython/pylab/matplotlib 绘图错误

python - 构建轮失败,当我尝试使用 pip 安装时

latex 投影仪 : way to change the bullet indentation?

r - 一个 block 中有多个图的图标题

使用列表和框架包格式化源列表

python - 移动图形时 matplotlib trisurf 缓慢

colors - 如何使用 Gnuplot 中格式为 `#aabbcc` 的数据列中声明的颜色为点着色?

gnuplot - 如何在gnuplot中使用一列数据作为图例?

python - 在 Sage 中使用 gnuplot 时出错,但在常规 Python 中工作正常