我想在一条路径上添加多个标记。但是,有时这些标记的位置严重错误。例如,蓝色箭头应该比红色箭头稍微靠前一点。
\begin{tikzpicture}
\draw plot[smooth, tension=.7] coordinates { (5*0.02109, 5*-0.12607)(5*0.2274, 5*-0.1806)(5*0.4037, 5*-0.02751)(5*0.536, 5*0.4091)(5*0.768, 5*0.2045)(5*0.7262, 5*-0.02055)(5*0.8538, 5*-0.1366) }
[postaction={decorate}, decoration={markings,
% Red arrows
mark=between positions 0.1 and 0.9 step 0.25 with {\arrow[red, line width=1mm]{>};},
% Blue arrows
mark=between positions 0.2 and 0.9 step 0.25 with {\arrow[blue, line width=1mm]{>};}
}]
;
\end{tikzpicture}
答案1
Ryan Reich(谢谢!)的评论是解决方案:多个后续操作。请注意,每个“装饰块”都需要自己的装饰后续操作。
\begin{tikzpicture}
\draw plot[smooth, tension=.7] coordinates { (5*0.02109, 5*-0.12607)(5*0.2274, 5*-0.1806)(5*0.4037, 5*-0.02751)(5*0.536, 5*0.4091)(5*0.768, 5*0.2045)(5*0.7262, 5*-0.02055)(5*0.8538, 5*-0.1366) }
[postaction={decorate, decoration={markings,
% Red arrows
mark=between positions 0.1 and 0.9 step 0.25 with {\arrow[red, line width=1mm]{>};}
}}]
[postaction={decorate, decoration={markings,
% Blue arrows
mark=between positions 0.2 and 0.9 step 0.25 with {\arrow[blue, line width=1mm]{>};}
}}]
;
\end{tikzpicture}