8

Tikz is weird when in comes to decorating tree edges. I'd like to draw a tree with a snakey line with an arrow in the middle. What sounds simple is somewhat tricky but I found a solution with a further draw action in the postaction. However the default arrowhead size is too small for my liking. Unfortunately tikz seems to ignores the scale option when drawing tree edges, the line width option however does work but it doesn't achieve what I want.

Here is my code together with an image depicting the problem. The upper arrow from the \draw command is how I'd like it to look.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.pathmorphing,decorations.markings,trees,arrows}
\begin{document}

\tikzset{
    con/.style={draw opacity=0,thick,
                decoration={markings,mark=at position .6 with {\arrow[blue!50!black,draw opacity=1,line width=0.5pt,scale=2]{angle 90}}},
                postaction={decorate},
                postaction={draw=blue!50!black,draw opacity=1,decoration={snake,amplitude=1pt, segment length=8pt},decorate}
               }
}

\begin{tikzpicture}[scale=2]
    \draw [con] (0,0.3) -- (1.5,0.3);
    \coordinate
        child[grow=east] {
            edge from parent [con]
        };
\end{tikzpicture}

\end{document}

The arrow on the tree edge is too small.

Any idea how to make the lower arrow look like the upper one?

7

Probably somewhere in the edge code the transformations are reset. So you can kindly remind TikZ to scale again either by opening a scope and appyling scale=x or using the low-level command \pgftransformscale.

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.pathmorphing,decorations.markings,trees,arrows}
\begin{document}

\tikzset{
    con/.style={draw=none,
                postaction={decoration={markings,mark=at position .6 with
                      {\pgftransformscale{3}\arrow[blue!50!black]{angle 90}}},decorate},
                postaction={draw,blue!50!black,decoration={snake,amplitude=1pt, 
                      segment length=8pt},decorate}
               }
}

\begin{tikzpicture}
    \draw [con] (0,0.3) -- (1.5,0.3);
    \coordinate
        child[grow=east] {
            edge from parent[con]
        };
\end{tikzpicture}
\end{document}

enter image description 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.