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}
pgfplots
in your question. Is there a particular reason for that? Because I already have an answer for your MWE.