TikZ:蛇形波浪图案,装饰精美

TikZ:蛇形波浪图案,装饰精美

编译以下代码时,我收到以下消息:Snakes have been superseded by decorations. Please use thedecoration libraries instead of the snakes library.我一直在寻找如何用snake=expanding waves装饰库替换第 35、37 和 39 行,但找不到。

\documentclass[a4paper,10pt]{scrartcl} 
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric,positioning,snakes}
\begin{document}
\begin{figure}
    \begin{tikzpicture}
        \begin{scope}[shift={(.37,0)}]
            \coordinate (csc1) at (180:3.5);
            \coordinate (csc2) at (330:3.5);
            \coordinate (csc3) at (300:3.5);
            \coordinate (csc4) at (270:3.5);
            \coordinate (csc5) at (240:3.5);        
            \coordinate (csc6) at (210:3.5);        
            \coordinate (info) at (135:3.5);
        \end{scope}
        \node (sc1) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc1) {};
        \node (sc2) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc2) {};
        \node (sc3) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc3) {};
        \node (sc4) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc4) {};
        \node (sc5) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc5) {};
        \node (sc6) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc6) {};
        \node (infonode) [align=center,fill,ellipse,color=yellow!50,opacity=.5,minimum height=1.5cm,minimum width=0.5cm,rotate=324,label=Info] at (info) {};
        \node (cp1) [align=center,fill,color=gray!50,label=below:CP,right=2cm of info,minimum height=.8cm] {};
        \node (cp2) [align=center,fill,color=gray!50,label=below:CP,right=1.1cm of cp1,minimum height=.8cm] {};
        \node (cp3) [align=center,fill,color=gray!50,label=below:CP,right=1.1cm of cp2,minimum height=.8cm] {};
        \node (cpexit) [align=center,fill,color=gray!50,label={[align=center]Exit\\Turnstile},right=1.1cm of cp3,minimum height=.8cm] {};
        \node (fake) [right=1cm of cp3] {};
        \draw (5.2,-4.5) -- (5.2,6);
        \draw (-4.5,-4.5) .. controls (-4.2,3) and (0,4) .. (0,6);
        \draw (infonode) -- (cp1);
        \node (mi1) at ($(cp1) !0.5! (cp2)$) {};
        \node (mi2) at ($(cp2) !0.5! (cp3)$) {};        
        \node (mi3) at ($(cp3) !0.5! (fake)$) {};
        \node (cam1) [above= 0mm of cp1,label=cam,circle,color=green,fill] {};
        \path (cam1) edge [snake=expanding waves,segment length=1mm,segment angle=30,draw,color=green] (mi1);
        \node (cam2) [above= 0mm of cp2,label=cam,circle,color=green,fill] {};
        \path (cam2) edge [snake=expanding waves,segment length=1mm,segment angle=30,draw,color=green] (mi2);
        \node (cam3) [above= 0mm of cp3,label=cam,circle,color=green,fill] {};
        \path (cam3) edge [snake=expanding waves,segment length=1mm,segment angle=30,draw,color=green] (mi3);
        \node (waiting) at ($(5.2,6) !0.5! (0,6)$) {Waiting Area};
        \node (Entry) at ($(5.2,-4.5) !0.5! (-4.5,-4.5)$) {Entry/Shop};
    \end{tikzpicture}
\end{figure}
\end{document}

答案1

不幸的是snake=<name>,它居然真的能工作。这确实不是正确的语法,更何况它已经被弃用了。

相反,通过添加decorations.pathmorphing库,您可以通过键使用它

decoration={expanding waves,angle=30,segment length=1mm},decorate,

完整代码

\documentclass[tikz]{standalone}
\usetikzlibrary{calc,shapes.geometric,positioning,decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}
        \begin{scope}[shift={(.37,0)}]
            \coordinate (csc1) at (180:3.5);
            \coordinate (csc2) at (330:3.5);
            \coordinate (csc3) at (300:3.5);
            \coordinate (csc4) at (270:3.5);
            \coordinate (csc5) at (240:3.5);        
            \coordinate (csc6) at (210:3.5);        
            \coordinate (info) at (135:3.5);
        \end{scope}
        \foreach \x in {1,...,6}{
        \node (sc\x) [align=center,fill,circle,color=yellow!50,opacity=.5,label=SCO] at (csc\x) {};
        }
        \node (infonode) [align=center,fill,ellipse,color=yellow!50,opacity=.5,minimum height=1.5cm,minimum width=0.5cm,rotate=324,label=Info] at (info) {};
        \node (cp1) [align=center,fill,color=gray!50,label=below:CP,right=2cm of info,minimum height=.8cm] {};
        \node (cp2) [align=center,fill,color=gray!50,label=below:CP,right=1.1cm of cp1,minimum height=.8cm] {};
        \node (cp3) [align=center,fill,color=gray!50,label=below:CP,right=1.1cm of cp2,minimum height=.8cm] {};
        \node (cpexit) [align=center,fill,color=gray!50,label={[align=center]Exit\\Turnstile},right=1.1cm of cp3,minimum height=.8cm] {};
        \node (fake) [right=1cm of cp3] {};
        \draw (5.2,-4.5) -- (5.2,6);
        \draw (-4.5,-4.5) .. controls (-4.2,3) and (0,4) .. (0,6);
        \draw (infonode) -- (cp1);
        \node (mi1) at ($(cp1) !0.5! (cp2)$) {};
        \node (mi2) at ($(cp2) !0.5! (cp3)$) {};        
        \node (mi3) at ($(cp3) !0.5! (fake)$) {};
        \node (cam1) [above= 0mm of cp1,label=cam,circle,color=green,fill] {};
        \path (cam1) edge [decoration={expanding waves,angle=30,segment length=1mm},decorate,draw,color=green] (mi1);
        \node (cam2) [above= 0mm of cp2,label=cam,circle,color=green,fill] {};
        \path (cam2) edge [decoration={expanding waves,angle=30,segment length=1mm},decorate,draw,color=green] (mi2);
        \node (cam3) [above= 0mm of cp3,label=cam,circle,color=green,fill] {};
        \path (cam3) edge [decoration={expanding waves,angle=30,segment length=1mm},decorate,,draw,color=green] (mi3);
        \node (waiting) at ($(5.2,6) !0.5! (0,6)$) {Waiting Area};
        \node (Entry) at ($(5.2,-4.5) !0.5! (-4.5,-4.5)$) {Entry/Shop};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容