how to decorate a parametric function drawn with \datavisualization?

I have to plot a few parametric curves like the one on the left below, and I would like to add small arrows to represent the direction of the plot as parameter t increases from 0 to π. I know how to add arrows on a curve using postaction=decorate as shown on the right example, but this does not appear to work on curves rendered by \datavisualization. Is there any other way to do it?

Essentially I would just like to equip the left plot with those blue arrows.

Here is the code I have for the above picture:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}

\begin{document}

\begin{tikzpicture}[decoration={markings,
mark=between positions 0 and 1 step 3mm
with { \arrow[blue]{>};}}]

% Decoration works here...
\draw[red,postaction=decorate] (2,0) to[out=-90,in=85] (4,0);

% ...but is ignored here.
\datavisualization[school book axes,
visualize as smooth line=f,
all axes={include value/.list={1,-1}},
f={style={red,postaction=decorate}}
]
data [format=function,set=f] {
var t : interval [0:pi] samples 50;
func x = cos(3 * \value{t}r) * cos(\value{t}r);
func y = cos(3 * \value{t}r) * sin(\value{t}r);
};
\end{tikzpicture}
\end{document}


EDIT: Two days later, I realized I could work around this by drawing the function in several pieces as follows:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{spy}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}

\begin{document}

\begin{tikzpicture}[spy using outlines={circle, magnification=5, size=1cm, connect spies}]

\foreach \i in {1,...,6}
\datavisualization[school book axes,
visualize as smooth line=f,
all axes={include value/.list={1,-1}},
f={style={red,->[blue]}}
]
data [format=function,set=f] {
var t : interval [pi*(\i-.5)/6:pi*(\i+.5)/6] samples 10;
func x = cos(3 * \value{t}r) * cos(\value{t}r);
func y = cos(3 * \value{t}r) * sin(\value{t}r);
};

\spy [green] on (.72,0.18) in node (zoom) at (.8, 1);
\end{tikzpicture}
\end{document}


However this has several drawbacks:

1. decomposition of the range in six parts is really dependent on the function I'm drawing,
2. I'm drawing the axes 6 times on top of each other and for some reason this produce thicker axes,
3. because the arrow tip is not flat, there is some gap between the end of one function piece and the start of the next one (as shown by the spy node).

Run with xelatex

\documentclass{standalone}
\begin{document}

\psset{unit=5}
\begin{pspicture}(-1.1,-1.1)(1.2,1.2)
\psaxes[Dx=0.5,Dy=0.5]{->}(0,0)(-1.1,-1.1)(1.1,1.1)
\psparametricplot
[plotpoints=100,algebraic,linecolor=red,
linewidth=2pt]{0}{Pi}{cos(3*t) * cos(t) | cos(3*t) * sin(t) }
\multido{\rA=0.34+0.50}{6}{%
\psparametricplot
[plotpoints=2,algebraic,linecolor=blue,arrows=->,arrowscale=2,
linewidth=2pt]{\rA}{\rA\space 0.01 add}{cos(3*t) * cos(t) | cos(3*t) * sin(t) }}
\end{pspicture}
\end{document}


• What is the reason for the values 0.34 and 0.50 in \rA=0.34+0.50? – Svend Tveskæg Jul 5 '14 at 15:03
• t=0.34+i*0.5 for the 6 values of t – user2478 Jul 5 '14 at 20:59
• Is there any diffence between \parametricplot and \psparametricplot? I noticed that both are available but I am not sure which one should we use. – Money Oriented Programmer Oct 10 '15 at 5:56
• \parametricplot is only there for compability to old versions of pst-plot – user2478 Oct 10 '15 at 6:02