2

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
5

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]
        \addplot3+[domain=0:1] (x,x^2,x^3);
    \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

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

2

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,
            ]


            \addplot +[smooth,thick]{x};
            \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}
            \caption{Your caption}
            \end{figure}

        \end{document}

OUTPUT:: enter image description here

  • @Cris if this answers your question please mark it as answered. Thank you. – Sari Dec 3 '17 at 10:06
  • I have already marked both answers. – Cris Dec 3 '17 at 15:11
  • you can mark it with the check mark sign not upvote :). – Sari Dec 3 '17 at 15:13
  • Done :) I finally found it :) – Cris Dec 3 '17 at 18:47

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.