[Tex/LaTex] Plotting a 3D parametric curve

pgfplotstikz-pgf

I am trying to plot the 3D curve $x=e^(t)*cos(t),y=e^(t)*sin(t),z=e^(t)$, $t\in[0,1]$, by using the code

\documentclass[tikz, border=2mm]{amsbook}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}

\begin{document}

\begin{figure}[h]
 \begin{tikzpicture}
        \begin{axis}
        [view={60}{30},axis lines=center,axis on top,
        xlabel=$x$,ylabel=$y$,zlabel=$z$, xtick={2},ytick={2},ztick={2},no marks,axis equal,xmin=-1,xmax=4,ymin=-1,ymax=4,zmin=-1,zmax=4,enlargelimits={upper=0.1}]
             \addplot3+[no markers,samples=200, domain=0:1,variable=t]({exp(t)*cos(t)},{exp(t)*sin(t)},{exp(t)});
        \end{axis}

 \end{tikzpicture}
\end{figure}

\end{document} 

and nothing is plotted. How can I fix this ?

Best Answer

First, I think you meant to use standalone as a class. And then the variable name should be a macro. Also the trig functions accept argument in degrees. So you need to mention that they are in radians with an additional r. To remove the final connection to the inital point you can add samples y=0, For example for the domain -pi:pi you get

\addplot3+[no markers,samples=51, samples y=0,domain=-pi:pi,variable=\t]
                                      ({exp(\t)*cos(\t r)},{exp(\t)*sin(\t r)},{exp(\t)});

Full code

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
   \begin{axis}[view={60}{30},
                axis lines=center,axis on top,
                xlabel=$x$,ylabel=$y$,zlabel=$z$,
                xtick={2},ytick={2},ztick={2},
                no marks,axis equal,
                xmin=-1,xmax=4,ymin=-1,ymax=4,zmin=-1,zmax=4,
                enlargelimits={upper=0.1}]
     \addplot3+[no markers,samples=51, samples y=0,domain=-pi:pi,variable=\t]
                                      ({exp(\t)*cos(\t r)},{exp(\t)*sin(\t r)},{exp(\t)});
  \end{axis}
\end{tikzpicture}
\end{document} 

enter image description here