[Tex/LaTex] Drawing arrows along a function in pgfplots

tikz-pgf

How does one insert arbitary placed arrows along a curve/function
defined in pgfplots using the \plot command. I realise the last sentence became a tad long.. Below is a simple code for which I am trying to insert arrows, if I had
points to go after, I could have used something like Pgfplots: Drawing Arrows Along Contour Plots
or decorations. But this does not work here…

Earlier i asked the same question with the draw function Add arrows to a smooth tikz function, and obtained a really good answer.
However implementing the solution directly to the code under gives missfortunate 'stack overflow' error. To summarize

  • Is there a way to place a number of arrows a long a function / curve made with pgfplots?

Presumably with a similar syntax to

\draw plot ... [arrow inside={end=stealth,opt={scale=2}}{0.25,0.5,0.75}];

Here is one figure I am trying to add a few arrows too

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{
    set arrow inside/.code={\pgfqkeys{/tikz/arrow inside}{#1}},
    set arrow inside={end/.initial=>, opt/.initial=},
    /pgf/decoration/Mark/.style={
        mark/.expanded=at position #1 with
        {
            \noexpand\arrow[\pgfkeysvalueof{/tikz/arrow inside/opt}]{\pgfkeysvalueof{/tikz/arrow inside/end}}
        }
    },
    arrow inside/.style 2 args={
        set arrow inside={#1},
        postaction={
            decorate,decoration={
                markings,Mark/.list={#2}
            }
        }
    },
}
\begin{document}
\begin{tikzpicture}
\draw node [circle] at (-1,0) {$z_0$};
\begin{scope}[very thick,rotate=45,decoration={
    markings,
    mark=at position 0.5 with {\arrow{>}}}]
\draw[domain=0:6.28,samples=200,smooth,] plot (xy polar
cs:angle=\x r,radius=      {1-sin(2*\x r)}) ;
\end{scope}
\end{tikzpicture} 
\end{document}

Lemniscate

Best Answer

As you didn't answer my comment yet, I will just post my solution to the problem I think you are trying to solve.

You may just use the code, given in my answer to this question: Add arrows to a smooth tikz function Next you will need to remove the smooth statement, because it will interfere with decorate and give you nice errors like ? Dimension too large. This won't have an effect on the smoothness of your drawing, because you already use sufficiently many samples.

Implementation

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{
  set arrow inside/.code={\pgfqkeys{/tikz/arrow inside}{#1}},
  set arrow inside={end/.initial=>, opt/.initial=},
  /pgf/decoration/Mark/.style={
    mark/.expanded=at position #1 with
    {
      \noexpand\arrow[\pgfkeysvalueof{/tikz/arrow inside/opt}]{\pgfkeysvalueof{/tikz/arrow inside/end}}
    }
  },
  arrow inside/.style 2 args={
    set arrow inside={#1},
    postaction={
      decorate,decoration={
        markings,Mark/.list={#2}
      }
    }
  },
}
\begin{document}
\begin{tikzpicture}
  \draw node [circle] at (-1,0) {$z_0$};
  \begin{scope}[very thick,rotate=45]
    \draw[domain=0:6.28,samples=200] plot (xy polar cs:angle=\x r,radius={1-sin(2*\x r)}) [arrow inside={}{0.25,0.5,0.75}];
  \end{scope}
\end{tikzpicture} 
\end{document}

Output

enter image description here