1

I would like to know how I can replicate the diagram below in latex.

thanks.

Edit: I can plot a function using tikz/pgfplots if I know how the function is defined. Unfortunately, I don't know how the function is defined in this case.

Nana
  • 305

1 Answers1

3

Using pgfplots you can do something like this:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
  axis lines=middle,
  domain=-1:7,
  yticklabels=\empty,
  xtick={-1,...,7},
  xticklabels={-1,...,7},
  samples=100
  ]
\addplot[no markers] {-0.1*x*(x-3)*(x-3)*(x-6)};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

Refer to the package documentation to adjust the settings according to your needs.

Gonzalo Medina
  • 505,128
  • 1
    I did:

    `\documentclass[english,a4paper,11pt,oneside]{article} \usepackage{tikz}

    \begin{document}

    \begin{tikzpicture}[domain=-.7:6.7,] \foreach \x/\xtext in {-1/-1, 1/1, 2/2, 3/3, 4/4, 5/5, 6/6, 7/7} \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$}; \draw[->] (-1.2,0) -- (7.2,0) node[right] {$x$}; \draw[->] (0,-6.2) -- (0,1.2) node[above] {$f(x)$}; \draw [samples=200] plot (\x,{-0.1\x(\x-3)(\x-3)(\x-6)}); \end{tikzpicture}

    \end{document}`

    and works well also. Sorry, I can't go to newline in comments...?

    – MattAllegro Apr 13 '14 at 00:41