Hinzufügen von Richtungspfeilen für ein parametrisches Diagramm

Hinzufügen von Richtungspfeilen für ein parametrisches Diagramm

Ich versuche, Richtungspfeile entlang des Pfads einer parametrischen Kurve hinzuzufügen. Ich habe herausgefunden, wie man die folgende Kurve erstellt (ignorieren Sie die rote Parabel):

\begin{document}

\section{2D Plots}

\begin{tikzpicture}

\begin{axis}[xmin=-10, xmax=10, ymin=-10, ymax=10, 
axis lines=middle,
xlabel = $x$,
ylabel = $y$]

\addplot[color=red]{4-x^2};
\addplot[ domain=0:5*pi,
    samples = 120, color = blue]
({2*cos(deg(2*x))},
{4*sin(deg(3*x)});

\end{axis}

\end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

Antwort1

Im pgfplotsDokumentationsabschnitt 4.17.4 „Platzieren von Dekorationen auf einem Grundstück“.

SmoothDiagramme werden zwischen aufeinanderfolgenden Punkten reibungslos interpoliert. Mit fpupräziserer Veclen-Funktion zur Dekoration.

\documentclass[border=5mm]{standalone}
%https://tex.stackexchange.com/questions/717063/adding-direction-arrows-for-a-parametric-graph
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{decorations.markings,fpu}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[xmin=-10, xmax=10, ymin=-10, ymax=10,
            axis lines=middle,
            xlabel = $x$,
            ylabel = $y$]

        \addplot[
            /pgf/fpu/install only=veclen,smooth,%<-- added
            blue,samples=127,domain=0:5*pi,
            postaction={decorate},% ------
            decoration={markings, % ------
                    mark=between positions .0 and 1. step .25 with {\arrow{stealth}},
                    % mark=at position 0.25 with {\arrow{stealth}},
                    % mark=at position 0.5 with {\arrow{stealth}},
                    % mark=at position 0.75 with {\arrow{stealth}}
                }
        ]({2*cos(deg(2*x))},{4*sin(deg(3*x)});
    \end{axis}
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen