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'm trying to plot two implicit curves (using pgfplots and raw gnuplot) but they don't appear in the document. In gnuplot it works just fine so I guess it has something to do with pgfplots but i can't figure out, what the problem is.

Example:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot +[raw gnuplot] gnuplot {
unset key
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 50,50;
set xrange [0:1]
set yrange [-1:1]
f(a,c) = a*cosh(c/a)-N
ell1(a,c) = (c/z)**2+(1/(1-cosh(z)))**2*(a-N/(cosh(z)))**2-(N/cosh(z))**2  
N = 1
z = 1.19968
splot f(x,y),ell1(x,y)
};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this question
1  
add the missing ; at the end of each command, then it should work –  texenthusiast Aug 6 '13 at 8:02
    
oh indeed. i thought they are optional as gnuplot didn't need them. Do you want to answer this or shall i flag my question for deletion? –  oerpli Aug 6 '13 at 8:11
1  
retain the question as it might look silly mistake ( sometimes silly can be brilliant) but someone may be in the same situation would benefit. I made the answer with the plot, hope it's the plot you are looking for –  texenthusiast Aug 6 '13 at 8:24
    
okay. thanks a lot. –  oerpli Aug 6 '13 at 8:29
add comment

1 Answer 1

up vote 2 down vote accepted

Converting my comment into answer

If you notice ur-file-name.pgf-plot.gnuplot created by first pdflatex -shell-escape ur-filename.tex compilation there is a missing ; at the end of each gnuplot command, then it may not work like in a terminal gnuplot(eg: command by command execution) as ; command line terminator is required to separate the gnuplot commands when fed in a file to gnuplot.

\documentclass[convert=false,border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document} 
\begin{tikzpicture}
\begin{axis}
\addplot +[raw gnuplot] gnuplot {
unset key;
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 50,50;
set xrange [0:1];
set yrange [-1:1];
f(a,c) = a*cosh(c/a)-N;
ell1(a,c) = (c/z)**2+(1/(1-cosh(z)))**2*(a-N/(cosh(z)))**2-(N/cosh(z))**2;  
N = 1;
z = 1.19968;
splot f(x,y),ell1(x,y);
};
\end{axis}
\end{tikzpicture}
\end{document}

Output:

enter image description here

share|improve this answer
add comment

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.