1

Trying to plot the 3D curve

(t,t^2,2*t^3), t\in [0,1],

with the code:

\begin{tikzpicture}
    \begin{axis}
    %view={105}{5}, 
    [samples y=0, axis lines=center,axis on top,xlabel=$x$, ylabel=$y$, zlabel=$z$]

     \addplot3+[no markers,variable=t,domain=0:1,blue,samples=80,samples y=0] (t,t^2,2*t^3);

    \end{axis}

    \end{tikzpicture}

I got the following output:

enter image description here

But I want to plot that curve in the regular coordinate system:

   \begin{tikzpicture}

        \draw[thick,->] (0,0,0)coordinate (O) -- (3,0,0) coordinate (X)
                node[anchor=north east]{$y$};
        \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north
                west]{$z$};
        \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$x$};

    \end{tikzpicture}

that is:

enter image description here

Which would be the code ?

Later Edit: By using view{95}{5}, the axes seem to be like in the second output, but not perfect:

\begin{tikzpicture}
        \begin{axis}
        [view={95}{5}, samples y=0, axis lines=center,axis on top,xlabel=$x$, ylabel=$y$, zlabel=$z$]

         \addplot3+[no markers,variable=t,domain=0:1,blue,samples=80,samples y=0] (t,t^2,2*t^3);
        \end{axis}
 \end{tikzpicture}

The output being: enter image description here

Stefan Pinnow
  • 29,535
Cris
  • 1,189

1 Answers1

1

This is not an answer but an attempt to understand the question better. In your desired coordinate system, you perform a cyclic permutation of the x-, y- and z-directions, right? If that's the case, why does a change of the view and relabeling of the axes by hand not work? A brute force solution, which is certainly not a final solution, is

\documentclass[border2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

        \draw[thick,->] (0,0,0)coordinate (O) -- (3,0,0) coordinate (X)
                node[anchor=north east]{$y$};
        \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north
                west]{$z$};
        \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$x$};
   \def\n{80} 
   \foreach \i in {1,...,\n} {
    \pgfmathsetmacro{\u}{(\i-1)/\n}
    \pgfmathsetmacro{\v}{((\i-1)/\n)^2}
    \pgfmathsetmacro{\w}{2*((\i-1)/\n)^3}
    \pgfmathsetmacro{\x}{(\i/\n)}
    \pgfmathsetmacro{\y}{(\i/\n)^2}
    \pgfmathsetmacro{\z}{2*(\i/\n)^3}
      \draw[-,blue,thick,smooth] (\v,\w,\u) -- (\y,\z,\x);
     }
    \end{tikzpicture}
\end{document}

enter image description here

I just posted this in order to find out whether this is the plot you want to get, and I understand that this is a hilariously complicated way of producing the plot.

  • thank you very much ! Indeed, this way is too complicated. By using view{95}{5}, the axes seem to be like in my second output. – Cris Dec 05 '17 at 06:36
  • @Cris That's what I thought. I was just confused by the comment that view would not work. A –  Dec 05 '17 at 16:53