6

I'm trying to decorate a snake path, but I don't get any output using a postaction. Here's the example code.

\begin{tikzpicture}
  \draw [snake=expanding waves, segment amplitude = 1.5cm, segment length = 0.3 cm, postaction={decorate, decoration={random steps,segment length=3pt,amplitude=5pt}}] (0,0) -- (-2,0);
\end{tikzpicture}

Any help would be greatly appreciated.

5

The postaction is newer drawn. You need to add a draw option to it. On the other hand, I guess that you don't want to draw the main path. In that case, you should change \draw to \path.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,snakes}
\begin{document}
\begin{tikzpicture}
    \path [
           snake=expanding waves, segment amplitude = 1.5cm, segment length = 0.3 cm, 
           postaction={draw,decorate, decoration={random steps,segment length=3pt,amplitude=5pt}}
          ]
          (0,0) -- (-2,0);
\end{tikzpicture}

\end{document}

result

  • Thanks, that worked. As a note, I had to change the \draw to a \path in order to achieve the effect I wanted (only the randomized postaction path). – Derek Mar 15 '11 at 23:54

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.