4

I would like to use tikz or a similar LaTeX package to draw the following curve in a three-dimensional coordinate system

(t^2, t*(1-t), 1-t) for t in (0,1).

Is there an easy way to do this? Thanks!

5

pgfplots is an option:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[variable=t,mesh,domain=0:1] (t^2,{ t*(1-t)}, 1-t);
\end{axis}
\end{tikzpicture}
\end{document}

which looks like

enter image description here


With view={<azimuth>}{<elevation>} you can rotate the view to an angle where the features of the curve are easier visible. If you want to help further with depth perception, you can for instance add e.g. support lines:

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

\begin{document}

\begin{tikzpicture}
\begin{axis}
[   view={60}{30},
    enlargelimits=false,
]
    \pgfplotsinvokeforeach{0,0.1,...,1}
    { \draw[gray] (#1*#1,#1-#1*#1,1-#1) -- (#1*#1,#1-#1*#1,0);
    }

    \addplot3[variable=t,mesh,domain=0:1] (t^2,t-t^2,1-t);

    \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

  • 1
    I shortly rendered it. – Ronny Dec 18 '15 at 16:29
  • You pictures looks almost exactly like I wanted them to be, thanks a lot! However, your code does not run for me. Copying exactly what you wrote, LaTeX gives me 'unknown anchor' for the command compat=1.12 and 'inaccessible' for the plot itself. Any ideas why? – catw Dec 21 '15 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.