如何绘制多个弯曲的箭头

如何绘制多个弯曲的箭头

我尝试使用 tikz 绘制蓝色箭头,但到目前为止我只能绘制红色箭头,而且效果不如预期。这是我到目前为止的代码,它很耗时,所以如果有人有更好的解决方案来绘制蓝色箭头,请告诉我。谢谢。

\begin{figure}[!htbp]
\begin{center}
\begin{tikzpicture}
\draw [<->,very thick] (0,6) -- (0,0) -- (8,0);
\draw [->, thick,red] (3.8,1.7)  -- (3.6,1.8);
\draw [->,thick,red] (6,6) to [out=110,in=-20] (5.75,6.25);
\draw [->,thick,red] (5.75,6.25) to[out=160,in=-20] (5.5,6.35);
\draw [->,thick,red] (5.5,6.35) to[out=160,in=50] (5,6.10);
\draw [->,thick,red] (5,6.10) to[out=-130,in=60] (4.75,5.75);
\end{tikzpicture}

在此处输入图片描述

答案1

你可以弯曲箭头,并且使用arc arrow样式可以将它们沿着路径放置,使它们沿着路径弯曲,并且该/.list键允许你绘制多个箭头。通过这些准备,你可以将代码简化为类似

\draw[red,very thick,my arrow/.list={0.2,0.45,0.7},-{Stealth[length=2mm,bend]}] 
 (6,6) to [out=110,in=60,looseness=1.4] (4.75,5.75);

完成 MWE:

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,bending,decorations.markings}
% source: https://tex.stackexchange.com/a/430239/121799
\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
    arc arrow/.style args={%
    to pos #1 with length #2}{
    decoration={
        markings,
         mark=at position 0 with {\pgfextra{%
         \pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
         \xdef\tmpArrowTime{\tmpArrowTime}}},
        mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
        mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
        mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
        mark=at position {#1} with {\coordinate(@4);
        \draw[-{Stealth[length=#2,bend]}]       
        (@1) .. controls (@2) and (@3) .. (@4);},
        },
     postaction=decorate,
     }
}
\begin{document}
\begin{tikzpicture}[my arrow/.style={arc arrow=to pos #1 with length 2mm}]
 \draw[red,very thick,my arrow/.list={0.2,0.45,0.7},-{Stealth[length=2mm,bend]}] 
 (6,6) to [out=110,in=60,looseness=1.4] (4.75,5.75);
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者,如果您想要这些间隙,您可以使用装饰show path construction

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,bending,decorations.pathreplacing}
% source: https://tex.stackexchange.com/a/430239/121799
\tikzset{multiple arrows/.style={decorate,decoration={show path construction,
 curveto code={
      \draw [#1] (\tikzinputsegmentfirst) .. controls
        (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
        ..(\tikzinputsegmentlast);
    },}}}
\begin{document}
\begin{tikzpicture}
\draw [multiple arrows={red,thick,-{Stealth[length=2mm,bend]}}] 
(6,6) to [out=110,in=-20] (5.75,6.25)
 to[out=160,in=-20] (5.5,6.35) to[out=160,in=50] (5,6.10) 
 to[out=-130,in=60] (4.75,5.75);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容