2

I'm trying to plot a Bode diagram with the bodegraph package, but the curve is not shown. I don't know what to do.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{bodegraph}

\begin{document}

\begin{tikzpicture}[gnuplot def/.append style={prefix={}},xscale=7/4]
\begin{scope}[yscale=2.5/100]
\semilog{-2}{2}{-40}{60}
\BodeGraph[thin,samples=100]{-1.5:1.5}
{\POAmpAsymp{8}{0.5}+\IntAmp{1}}
\BodeGraph{-1.5:1.5}{\POAmp{8}{0.5}+\IntAmp{1}}
\end{scope}
\begin{scope}[yshift=-2cm,yscale=2.5/200]
\OrdBode{20}
\semilog{-2}{2}{-200}{0}
\BodeGraph[samples=100,thin]{-2:2}
{\POArgAsymp{8}{0.5}+\IntArg{1}}
\BodeGraph{-2:2}{\POArg{8}{0.5}+\IntArg{1}}
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

egreg
  • 1,121,712
H.H
  • 826

2 Answers2

3

If I run your example, named test.tex, with

pdflatex test

I indeed get no picture, but four files called 1.gnuplot, 2.gnuplot, 3.gnuplot and 4.gnuplot are written out.

You need to run gnuplot over them and rerun pdflatex. Or, more easily, run

pdflatex -shell-escape test

so gnuplot will be called during the LaTeX run.

enter image description here

Note that you need gnuplot on your system to begin with. From the package manual:

Les commandes de tracés nécessitent que gnuplot (http://www.gnuplot.info/) soit installé et utilisable par votre distribution LaTeX.

English translation:

Plotting commands require that gnuplot (http://www.gnuplot.info/) be installed and usable by your LaTeX distribution.

egreg
  • 1,121,712
0

I come across the same problem with you.Finally I solve this by following this:

PGF/TikZ provides a convenient mechanism for plotting functions using GNUPLOT_. To run this example for the first time you have to do the following:

  • GNUPLOT must be installed on your system. Try typing gnuplot on the command line to see if it's installed. Windows users may have to rename wgnuplot to gnuplot.
  • You must allow TeX to run external programs. The command line option to enable this is usually --shell-escape or --enable-write18 PGF will call GNUPLOT for you and store the data in a file. Next time you compile the example, data will be loaded from the generated file. See section 11.12.3 in the manual for more information.

They come from the example file here http://www.texample.net/tikz/examples/gnuplot-basics/

If you use VS code, you can refer to this(VS Code - Latex Workshop - custom recipes file location) to enable the --shell-escape.