Pgfplots, 지정된 위치에 장식용 화살표 중앙을 배치합니다.

Pgfplots, 지정된 위치에 장식용 화살표 중앙을 배치합니다.

파라메트릭 곡선의 수직 부분에 화살표를 그리고 싶습니다. 예를 들어 다음 트로코이다를 생각해 보세요.

\documentclass{scrbook}

\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{
    arrows.meta
  , bending
  , decorations.markings
  }
\pgfplotsset{compat = 1.17}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        width           = 0.4\textwidth
      , height          = 0.25\textwidth
      , axis equal
      , axis lines      = middle
      , enlargelimits   = false
      , tick style      = {draw = none}
      , ymin            = {0.0}
      , xtick           = \empty
      , ytick           = \empty
      ]
        \addplot+[
            no markers
          , thick
          , domain =  -2.08869:8.37188
          , smooth
          , postaction = {decorate}
          , decoration = {
                markings
              , mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
              , mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
              }
          ] ({x - 1.5 * sin(x r)}, {1.5 - 1.5 * cos(x r)});
    \end{axis}
\end{tikzpicture}

\end{document}

나는 해당 적분을 계산했고 곡선의 "수직" 부분의 위치가 전체 길이의 분수로 표현되는 0.132와 0.210이라는 것을 알고 있습니다. 화살표 끝이 바로 여기에 위치하기 때문에 결과가 보기 흉해 보입니다.

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

화살표의 끝 부분이 아닌 이 지점에 화살표의 중심을 배치하는 방법은 무엇입니까?

추가 질문: "bend"를 지정했지만 전혀 구부러진 것처럼 보이지 않습니다. 왜?

답변1

표시 의 길이를 명시적으로 정의하기 때문입니다 \arrow. 를 사용할 수 있습니다 decoration tranform. §24.4.1을 참조하세요 pgfmanual. 현재의 경우 화살표를 절반 길이만큼 이동했습니다.

여기에 파란색 플롯과 투명 빨간색으로 체로 쳐진 플롯이 있는 출력이 있습니다.

% arara: lwpdflatex
\documentclass{scrbook}

\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{
    arrows.meta
  , bending
  , decorations.markings
  }
\pgfplotsset{compat = 1.17}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
            width           = 0.4\textwidth
            , height          = 0.25\textwidth
            , axis equal
            , axis lines      = middle
            , enlargelimits   = false
            , tick style      = {draw = none}
            , ymin            = {0.0}
            , xtick           = \empty
            , ytick           = \empty
        ]
        \addplot+[
            no markers
            , thick
            , domain =  -2.08869:8.37188
            , smooth
            , trig format=rad
            , postaction = {decorate}
            , decoration = {
                    markings
                    , mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
                    , mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
                }
        ] ({x - 1.5 * sin(x)}, {1.5 - 1.5 * cos(x)});
        \addplot+[
            no markers
            , thick,opacity=0.5
            , domain =  -2.08869:8.37188
            , smooth
            , trig format=rad
            , postaction = {decorate}
            , decoration = {
                    markings
                    , transform={xshift=1mm}
                    , mark = at position 0.132010 with {\arrow{Stealth[length = 2mm, bend]}}
                    , mark = at position 0.210413 with {\arrow{Stealth[length = 2mm, bend]}}
                }
        ] ({x - 1.5 * sin(x)}, {1.5 - 1.5 * cos(x)});
    \end{axis}
\end{tikzpicture}

\end{document}

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

관련 정보