Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

\begin{tikzpicture}
\begin{axis}[view={0}{90}] 
\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

1 Answer 1

up vote 3 down vote accepted

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

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.7}

\begin{document}

\begin{tikzpicture}

    \begin{axis}[
        %   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,
             fixed zerofill,
             precision=1,
             /tikz/.cd
            }
          , y tick label style={
             /pgf/number format/.cd,
             fixed,
             fixed zerofill,
             precision=1,
             /tikz/.cd
            }
        ]

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

\end{tikzpicture}

\end{document}

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

 
discard

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.