# PGFplots and GNUplot with addplot3

I am trying to plot the following:

\documentclass[tikz, convert = false]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.9}

\begin{document}
\begin{tikzpicture}
\begin{axis}[view = {70}{30}]
gnuplot[id = surf] (x, {1/x*cos(deg(y))}, {1/x*sin(deg(y))});
\end{axis}
\end{tikzpicture}
\end{document}


I only receive a 2d blank axis back. I am not that familiar with using gnuplot with addplot3, so I am under the impression I am not calling gnuplot correctly in this case.

With Henri Menke's solution, we do get a plot but it isn't correct. Here is a correct plot without using gnuplot:

Here is a different angle of Henri's plot where you can see the the issue more clearly.

-
Do you have -shell-escape option to pdflatex? –  Peter Grill Apr 22 '14 at 4:31
@PeterGrill yes. I use gnuplot all the time for 2d plots. –  dustin Apr 22 '14 at 4:34

If you want to use the raw gnuplot option, then you have to supply gnuplot code as the plot command.

% arara: pdflatex: {shell: yes}
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={70}{30}]
\addplot3[raw gnuplot,surf] gnuplot[id=surf] {set parametric; splot[-5:5][-5:5] v,1/v*cos(u),1/v*sin(u)};
\end{axis}
\end{tikzpicture}
\end{document}


-
This method did get it to work but the plot is incorrect. I will edit my question to show the issue. –  dustin Apr 23 '14 at 11:20
@dustin That is a problem with the sorting of the z-values. I also have tried this several times and didn't get it to work properly. I will again have a look into this. –  Henri Menke Apr 23 '14 at 13:31
Not problem. Maybe the two contrasting diagrams will draw more interest as well. –  dustin Apr 23 '14 at 13:35
Pgfplots tries to apply the standard z ordering as for a normal matrix plot. Writing z buffer=sort will repair it for every view angle. –  Christian Feuersänger Apr 23 '14 at 16:32
@ChristianFeuersänger z buffer = sort didn't solve the problem. –  dustin Apr 24 '14 at 16:35