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

1
  • It just red grids with no blue curve like the attached picture.
    – H.H
    Dec 30, 2017 at 12:00

2 Answers 2

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.

6
  • I'm using texlive for typesetting and I run the MWE with pdflatex but it's still just two red grids.
    – H.H
    Dec 30, 2017 at 12:26
  • @H.H You need to enable -shell-escape and also to have gnuplot available on your system.
    – egreg
    Dec 30, 2017 at 13:18
  • I have enabled -shell-escape already. how can I see whether gnuplot is available or not?
    – H.H
    Dec 30, 2017 at 13:23
  • @H.H Look in the log file, you should see what happens: look for runsystem. What's your operating system?
    – egreg
    Dec 30, 2017 at 13:29
  • I have TeXLive on windows.
    – H.H
    Dec 30, 2017 at 13:36
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.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .