TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using pgfplots and tikz library for generating some figures. my problem is that I can not use gnuplot within pgfplots. I tried to compile the following code bu seemingly the gnuplot is not recognized.

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

Anyone knows which package I should include?

share|improve this question
Use pdflatex --shell-escape yourfile. Yourfile is actually your tex file. Make sure that the gnuplot executable is in system's path. – Harish Kumar Feb 10 '13 at 0:24
up vote 3 down vote accepted

Compile this with --shell-escape. Also make sure that gnuplot is installed and is in system's path:

\pgfplotsset{compat = 1.7}



        %   title = {$x \times y$}
        , xlabel = $x$
            , ylabel = $y$
            , domain = -1:1
            , y domain = -1:1
        , enlargelimits
        , view = {0}{90}
        , x tick label style={
             /pgf/number format/.cd,
             fixed zerofill,
          , y tick label style={
             /pgf/number format/.cd,
             fixed zerofill,

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



enter image description here

share|improve this answer
Just beautiful. – vonbrand Feb 10 '13 at 0:29
I don't know how can I compile with --shell--escape? I'm using win7 – batista cori Feb 10 '13 at 0:35
@batistacori Which editor you are using to type your latex code? – Harish Kumar Feb 10 '13 at 0:46
solved thanks... I replaced my \begin{axis} with yours. – batista cori Feb 10 '13 at 0:47
@HarishKumar another problem occurs. when I change the function of the plot. nothing is changed in pdf view. it is always like the above image – batista cori Feb 10 '13 at 1:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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