파라메트릭 그래프에 방향 화살표 추가

파라메트릭 그래프에 방향 화살표 추가

파라메트릭 곡선의 경로를 따라 방향 화살표를 추가하려고 합니다. 아래 곡선을 만드는 방법을 알아냈습니다(빨간색 포물선은 무시).

\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}

여기에 이미지 설명을 입력하세요

답변1

의 문서 pgfplots섹션 4.17.4 플롯 상단에 장식 배치.

Smooth플롯은 연속된 점 사이를 부드럽게 보간합니다. 를 사용 fpu하면 더욱 정밀한 장식용 베클렌 기능을 사용할 수 있습니다.

\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}

여기에 이미지 설명을 입력하세요

관련 정보