1

I'm trying to use Tikz to plot a rough schematic of the "Allee effect" in population dynamics. However, I've been struggling with the finishing touches.

Below is my try:

\begin{tikzpicture}
  \draw[->] (-3,0) -- (4.2,0) node[right] {$x$};
  \draw[->] (0,-3) -- (0,4.2) node[above] {$f(x)$};
  \draw[scale=0.5,domain=-1:6.5,smooth,variable=\x,blue] plot ({\x},{0.5*\x*(\x-6)*(1-\x/1.8)});
\end{tikzpicture}

And this is what I'm looking to get:

enter image description here

Drawing the "flow" arrows on the plot it's been a headache. Can someone please point me in the right direction? It'd be much appreciated.

6

You can add the arrow tips with the help of the decorations.markings library, the intersections with the axis can be found and marked with help of the intersections library, and the nodes can be placed for example relative to the intersections using the positioning library.

enter image description here

\documentclass{article}
\usepackage{tikz} 
\usetikzlibrary{decorations.markings,intersections,positioning}
\begin{document}
\begin{tikzpicture}[decoration={
markings,% switch on markings
mark=at position 0.2 with {\arrow{stealth}},
mark=at position 0.25 with {\arrowreversed{stealth}},
mark=at position 0.32 with {\arrowreversed{stealth}},
mark=at position 0.4 with {\arrow{stealth}},
mark=at position .8 with {\arrow{stealth}},
mark=at position .9 with {\arrowreversed{stealth}}}]

  \draw[->,name path=xaxis] (-3,0) -- (4.2,0) node[right] {$x$};
  \draw[->] (0,-3) -- (0,4.2) node[above] {$f(x)$};
  \draw[scale=0.5,domain=-1:6.5,smooth,variable=\x,blue,postaction={decorate},name path=plotline] plot ({\x},{0.5*\x*(\x-6)*(1-\x/1.8)});

\fill [name intersections={of=xaxis and plotline}] (intersection-1) circle[radius=2pt] (intersection-2) circle[radius=2pt] (intersection-3) circle[radius=2pt];

\node [below left=of intersection-1] {$n=a$};
\node [below right=of intersection-1] {$n=b$};
\node [below right=of intersection-3] {$n=k$};
\end{tikzpicture}
\end{document}

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.