latex - 如何使用 Gnuplot 在 Latex 中绘图?

标签 latex gnuplot

早些时候我使用过 Gnuplot 并创建了一个 pdf -file 然后我通过 includegraphics 实现在我的 Latex -文档。

没有更好的方法可以直接从 Latex 绘图吗? -文档与 Gnuplot ?

最佳答案

基本上你可以跟着这个Youtube-Tutorial

所以这里是步骤:

第一步:设置环境变量

安装后MikTex , TexStudioGnuplot点击 Start -> 右键单击​​ Computer -> Settings -> Advanced Systemsettings -> Environment variables
在这里,您必须创建 3 个新变量:

► PATH
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin;C:\Program Files (x86)\gnuplot\bin

► gnuplot
C:\Program Files (x86)\gnuplot\bin

► GNUPLOT_LIB
C:\Program Files (x86)\gnuplot\demo

第 2 步:编辑 TexStudio
转到 TexStudio 并单击 Options -> Configure TexStudio -> Commands
在这里你需要更新上面的两个命令
► LaTeX
"C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/latex.exe" -src -interaction=nonstopmode %.tex

► PdfLaTeX
pdflatex.exe -synctex=1 -shell-escape -enable-write18 -interaction=nonstopmode %.tex

第 3 步:在 Latex 中使用 Gnuplot 编写代码
\documentclass[a4paper]{scrartcl}
\usepackage[miktex]{gnuplottex}

\begin{document}
\begin{figure}[H]
    \centering
    \begin{gnuplot}[terminal=pdf]
        set terminal pdf enhanced size 14.5cm, 4cm
        set key top left
        set xlabel 'x [1]'
        set ylabel 'y [1]'

        f1(x)=sin(x**2)

        plot f1(x) title 'y_1 = sin(x^2)'
    \end{gnuplot}
    \caption{Plot}
\end{figure}
\end{document}

关于latex - 如何使用 Gnuplot 在 Latex 中绘图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36386656/

相关文章:

r - 错误 : Missing $ inserted when using kable

c++ - 通过 fork 和 pipeline 调用 gnuplot 并更新绘图

for-loop - 在 gnuplot 中使用 for 循环绘制多列,key 不起作用

matrix - 无法在 Gnuplot 中绘制矩阵

latex - 为什么我的 Latex 文本会自行更改理由?

emacs - 在 Emacs 中使用 texcount 来确定 Latex 或 tex 文件的字数(需要可选参数)

latex - Latex 文档中的奇怪 Bibtex 行为

angular - Angular4 的 Latex 方程

Gnuplot Postscript 特殊字符数学方程

bash - 使用 gnuplot 从 CSV 生成图表