答案1
这是另一种选择,使用sin
和cos
操作:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[ultra thick,cyan,->,>=latex]
(-2,0) --
(0,0) sin (0.5,3) cos (1,0) sin (1.5,-3) cos (2,0)
sin (2.5,2) cos (3,0) sin (3.5,-2) cos (4,0)
sin (4.5,4) cos (5,0) sin (5.5,-4) cos (6,0)
sin (6.25,1.5) cos (6.5,0) sin (6.75,-1.5) cos (7,0)
-- ++(1.5,0);
\end{tikzpicture}
\end{document}
同一主题的变体,但使用plot
:
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\begin{scope}[cyan,ultra thick]
\draw
(-1,0) -- (0,0);
\draw[domain=0:2*pi,x=10pt]
(0,0) plot (\x,{sin(\x r)}) coordinate (end1);
\draw[shift={(end1)},domain=0:2*pi,x=10pt,smooth]
(end1) plot (\x,{2*sin(\x r)}) coordinate (end2);
\draw[shift={(end2)},domain=0:2*pi,x=10pt,smooth]
(end2) plot (\x,{5*sin(\x r)}) coordinate (end3);
\draw[shift={(end3)},domain=0:2*pi,x=3pt,smooth]
(end3) plot (\x,{0.5*sin(2*\x r)}) coordinate (end4);
\draw[->,>=latex] (end4) -- ++(1,0);
\end{scope}
\end{tikzpicture}
\end{document}
答案2
TikZ 有一个名为 的路径修饰random steps
。通过调整段长度和振幅值,您应该能够获得足够疯狂的路径。对于周期性(且不那么疯狂)的路径,您可以使用修饰snake
,它具有类似的可调整参数。请参阅 TikZ 文档中的第 24 节。
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw[-stealth,decorate,decoration={random steps,segment length=3pt,amplitude=4pt,pre length=2pt,post length=3pt}] (0,0) -- (2,0);
\draw[-stealth,decorate,decoration={snake,amplitude=3pt,pre length=2pt,post length=3pt}] (0,-0.5) -- ++(2,0);
\end{tikzpicture}
\end{document}