# Drawing a curve knowing its parametric equations

I want to draw with TikZ a curve, knowing its parametric equations.

The curve is given by:

$\gamma :\left\{ \begin{array}{c} x=t, \\ y=t^{2}, \\ z=t^{3},% \end{array}% \right. t\in \left[ 0,1\right] .$


Which would be the code for this plotting?

• See the pgfplots package that builds on tikz and deals specifically with plotting. The documentation contains several examples of this type. – Andrew Swann Dec 3 '17 at 8:40

You can do it either TikZ or pgfplots way

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
In TikZ

\begin{tikzpicture}
\draw[domain=0:1,smooth,variable=\t]plot (\t,\t^2,\t^3);
\end{tikzpicture}

In pgfplots

\begin{tikzpicture}
\begin{axis}[samples y=0]
\end{axis}
\end{tikzpicture}

\end{document}


The extra option is due to Artificial Line in PGFPlots 3D Parametric Plots?

Here is a working example for your requirements.

        \documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
legend pos= north west,
]

\addlegendentry{$x=t$ }

\addplot +[smooth,thick] []{x^2}; %Linear regression 1st order 1984-2017
\addlegendentry{$y=t^2$ }

\addplot +[smooth,thick] []{x^3}; %Linear regression 1st order 1984-2017
\addlegendentry{$y=t^3$}
\end{axis}
\end{tikzpicture}