This is a frequently asked question but none I have seen actually helped me. My problem is that I installed Gnuplot 5 and I have not been able to make it work in the TeXworks. The figure I have been trying to plot is this:
\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\usepackage{listings}
\usepackage{pgfplots}
\usepackage[miktex]{gnuplottex}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
title={Contour plot, view from top},
view={0}{90}
]
\addplot3[
contour gnuplot={levels={0.8, 0.4, 0.2, -0.2}}
]
{sin(deg(sqrt(x^2+y^2)))/sqrt(x^2+y^2)};
\end{axis}
\end{tikzpicture}
\end{document}
As many answers have suggested I tried to call gnuplottex in the preamble with the code
\usepackage[miktex]{gnuplottex}
yet this did not help and instead I have been getting the error
Package pgfplots Error: sorry, plot file{.._contourmp0.table} could not be opened. See the pgfplots package documentation for explanation
followed by the warning that Shell escape is not enabled.
Could you please help me in making this work?
EDIT I am aware that there is a phenomenally identical question on this site, namely gnuplottex with windows 8.1 but it does not address my problem. The problem persists even after using \usepackage[miktex]{gnuplottex}, as I pointed out from the beginning.
Following suggestions, I have made sure there is a path towards the bin directory and have included the statement --enable-write18 in the PdfLaTeX command line of TeXworks. All other suggestions are of course welcome.
Also here is my attempt to compile through the command line:

And my Texmaker configuration:


PATHvariable worked, this question is a duplicate of pgfplots contour example error. – moewe Apr 03 '15 at 15:19