如何将代码从蛇更改为 decorators.pathmorphing

如何将代码从蛇更改为 decorators.pathmorphing

我在 Tikz 的一个实例中有以下曲线:

\draw[->,snake=snake, 段幅度=.2mm, 段长度=1.5mm, 蛇后线=0.5mm] (2.8,0.9) -- (2.4,0.9);

由于 Tikz 的库 Snakes 已被 decorations 取代,我想使用 decorations.pathmorphing 进行同样的绘制。但是我不知道该怎么做。希望得到一些帮助。

答案1

根据 pgfmanual 第 356 页

在此处输入图片描述

我提议

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{snakes,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw[->,snake=snake, segment amplitude=.2mm, segment length=1.5mm, line after snake=0.5mm] (2.8,0.9) -- (2.4,0.9);

\draw[->,decorate,decoration={coil,aspect=0,amplitude=.2mm, segment
length=1.5mm,post length=0.5mm}] (3.8,0.9) -- (3.4,0.9);

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容