1

I'm trying to plot a sine wave, however, when I run it, the following error results:

Package pgfplots Error: Sorry, the gnuplot-result file 'main.sin.table' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot .gn uplot' manually on the respective gnuplot file..

My MWE is the following:

 \documentclass[14pt]{extarticle}
 \usepackage[margin=1in]{geometry} 
 \usepackage{amsmath,amsthm,amssymb,vector,physics,enumitem,mathtools}
 \usepackage{etoolbox}
 \usepackage[explicit]{titlesec}
 \usepackage{esvect}
 \usepackage{tikz}
 \usepackage{varwidth}
 \usetikzlibrary{calc,patterns,angles,quotes}
 \usetikzlibrary{through,calc,arrows}
 \usepackage{pgfplots}

 \begin{document}
 \begin{tikzpicture}
 \begin{axis}[
    xlabel=$x$,
    ylabel=$\sin(x)$
]
% invoke external gnuplot as
% calculator:
\addplot gnuplot[id=sin]{sin(x)};
\end{axis}
\end{tikzpicture}

\end{center}
\end{document}

I already try solve it by following this answer: How to enable shell-escape in TeXworks?

Can anyone help me, please?

  • do you have gnuplot installed? – David Carlisle Apr 25 '18 at 18:58
  • Yes, I do. I just installed it. – user151562 Apr 25 '18 at 19:13
  • You can plot a sine without gnuplot. – user121799 Apr 25 '18 at 19:28
  • Can you tell me how @marmot? – user151562 Apr 25 '18 at 19:36
  • Just remove gnuplot (I think). I also find it strange that you don't specify a domain. This should work: \addplot[domain=0:6,samples=100][id=sin]{sin(deg(x))}; . – user121799 Apr 25 '18 at 19:38
0

Too long for a comment. Can you compile

\documentclass[14pt]{extarticle}
 \usepackage[margin=1in]{geometry} 
 \usepackage{pgfplots}

 \begin{document}
 \begin{tikzpicture}
 \begin{axis}[
    xlabel=$x$,
    ylabel=$\sin(x)$
]
\addplot[domain=0:6,samples=100,id=sin]{sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}

On my TeXLive 2017 distribution it produces.

enter image description here

Notice that I have stripped off all unnecessary packages and libraries. (And I do not have vector.sty.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.