I'm trying to get contour gnuplots working on Windows 10 with TexMaker and MiKTeX, but I keep getting the error: "sorry, plot file {file.table} could not be opened."

I have the latest version of gnuplots installed and it seems to be working on its own, but I'm not sure how to get it working in pgfplots.

I'm trying to run

        \addplot3 [contour gnuplot] {x*y};

as a test case. Any help would be appreciated.

  • 3
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Dec 10 '18 at 16:41
  • Are you compiling with -shell-escape?
    – user121799
    Dec 10 '18 at 16:44
  • @marmot Yes. I have tried -shell-escape and --enable-write18. Compiling with either gives the same error.
    – Mobius
    Dec 10 '18 at 16:46

Most likely this is the common problem of gnuplot.exe not on path at the same time as TeX is running I built an mwe at Problem with contour plots however the core is to

Open a cmd prompt anywhere OTHER than the gnuplot directory and enter

> gnuplot -V

If you get a version message similar to gnuplot 5.3 etc. Then all should be fine.

IF you get the message starting 'gnuplot' is not recognized as an internal or external command, then you need to find which path it is on so type in

> where /r \ gnuplot.exe

if you get no response then you need to install it

If you get a line with a path such as

C:\gsl shell\octave-4.4.1-w32\octave-4.4.1-w32\bin\gnuplot.exe

then you need to ensure the bin is in your path so in the above case I need to add (without any quotes)

set path=C:\gsl shell\octave-4.4.1-w32\octave-4.4.1-w32\bin;%path%

prior to running either Texmaker or MiKTeX

Running my mwe and repeating that critical step on path I was able to compile your mwe

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.