5

I'm far from being an expert in TikZ because I just start using it.

I would like to be able to plot this comparison of equations:

WolframAlpha

This plot came from the Wolfram Alpha, which is a very good website to obtain results, but unfortunately not free to download the displayed result...

I try something like:

\begin{tikzpicture}[domain=0:10]
    \draw[very thin,color=gray] (-0.1,-1.1) grid (9.9,2200.9);
    \draw[->] (-0.2,0) -- (10.2,0) node[right] {$x$};
    \draw[->] (0,-0.2) -- (0,2201.2) node[above] {$f(x)$};

    \draw[color=blue] plot[id=x] function{x*x*x} 
         node[right] {$f(x) =x^3$};

    \draw[color=blue] plot[id=x] function{2^x * x} 
         node[right] {$f(x) = 2^x \times x$};
\end{tikzpicture}

But I've got issue with the scale, with the display etc... and I have no idea how to fix this :/

Thanks in advance for your help,

Best Regards.

8

You can use pgfplots.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
  \begin{tikzpicture}
    \begin{axis}[domain=0:10,scaled ticks=false,ymax=2000,ymin=2,minor tick num=1,xlabel=$x$, ylabel=$f(x)$]
      \addplot+[no marks,thick] {x^3};
      \addlegendentry{$x^3$};
      \addplot+[no marks,thick] {x*(2)^x};
      \addlegendentry{$2^x\,x$};
    \end{axis}
  \end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||
  • I think I start to realize that this package is really powerful :) thank a lot ! – Valentin Montmirail Aug 24 '15 at 13:19
  • 2
    @ValentinMontmirail It really is. If you want to plot something, go for pgfplots first. :) – user11232 Aug 24 '15 at 13:19

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.