0

In the following TikZ example I would like to replace the usage of snakes with decorations. How can I adjust the segment object length with decorations?

\documentclass[tikz, preview=true]{standalone}

\usetikzlibrary{snakes}
\usetikzlibrary{decorations.pathmorphing}
\tikzstyle{radiowave old}=[snake=waves,
                           segment length=1mm,
                           segment object length=4mm,
                           segment angle=30
                         ]

\tikzstyle{radiowave new}=[decorate, 
                       decoration={waves,
                         segment length=1mm,
                         %segment object length=4mm, <- not available
                         angle=30}
                      ]

\begin{document}
  \begin{tikzpicture}                         
    \draw[radiowave old] (-1,1) to node[left,pos=0] {old} (1,-1);                     
    \draw[radiowave new] (-1,-1) to node[right,pos=1] {new} (1,1);
\end{tikzpicture}
\end{document}

TikZ example with waves

0
3

The key is called radius. I also converted your usage of the deprecated \tikzstyle to the modern \tikzset.

\documentclass[tikz, preview=true]{standalone}
\usetikzlibrary{snakes}
\usetikzlibrary{decorations.pathmorphing}
\tikzset{
  radiowave old/.style={
    snake=waves,
    segment length=1mm,
    segment object length=4mm,
    segment angle=30
  },
  radiowave new/.style={
    decorate, 
    decoration={
      waves,
      segment length=1mm,
      radius=4mm,
      angle=30
    }
  }
}
\begin{document}
\begin{tikzpicture}                         
  \draw[radiowave old] (-1,1) to node[left,pos=0] {old} (1,-1);                     
  \draw[radiowave new] (-1,-1) to node[right,pos=1] {new} (1,1);
\end{tikzpicture}
\end{document}

enter code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.