1

On page 42/571 of the pgfplots package there is an example using \addplot+ and gnuplot as below:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+ [id=parable,domain=-5:5,] gnuplot {4*x**2 - 5} node [pin=180:{$4x^2-5$}]{};
\end{axis}
\end{tikzpicture}
\end{document}

I run using pdfLaTeX getting an error:

Package pgfplots Error: Sorry, the gnuplot-result file 'f2_addplot_pgfplots_p

p42.parable.table' could not be found. Maybe you need to enable the shell-escap

e feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invo

ke '>> gnuplot .gnuplot' manually on the respective gnuplot file..

See the pgfplots package documentation for explanation.

Type H for immediate help.

...

l.9 ...t {4*x**2 - 5} node [pin=180:{$4x^2-5$}]{};

Do you know how to fix this? Should I install gnuplot?

11
  • Hav you checked here (tex.stackexchange.com/questions/120218/…) if you have installed and configured everything correctly?
    – Excelsior
    Commented Apr 9, 2021 at 6:56
  • Checked but couldn’t understand. Should I reinstall my latex ?
    – Aria
    Commented Apr 9, 2021 at 17:57
  • 1
    Besides having a working LaTeX installation you need two more requirements to make the example compile without error messages. 1. You need to have gnuplot installed and it should be reachable from command line (e.g. open the Command Prompt cmd and type gnuplot --version which should return something similar to gnuplot 5.2 patchlevel 8). 2. You need to run pdflatex with shell-escape, i.e. pdflatex -shell-escape ... or pdflatex --enable-write18 .... Commented Apr 9, 2021 at 18:09
  • Thanks how to run pdflatex with -shell/escape?
    – Aria
    Commented Apr 9, 2021 at 18:12
  • That depends ... If you run it "by hand" you simply type this option, if you use an editor it depends on the editor. If you are lucky this is answered here on TeX.SX. Try searching for enable shell escape + your editor. Maybe you can find it in the help of your editor or another resource of your editor. Let us know if you were successful. Good luck! Commented Apr 9, 2021 at 18:17

0

Browse other questions tagged .