2

How can I change the color and style (like dashed or dotted) of only one branch, say the one between parent and grand-parent of a and b?

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}        

\begin{tikzpicture}[every tree node/.style={font=\huge},
level distance=1.1cm,sibling distance=.8cm, 
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes

\Tree 
[
\edge node[near end,left] {branch};
[   
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]        
]        
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[   
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]

\end{tikzpicture}

\end{document}
2

As you already have \edge everywhere, it's simply a matter of doing e.g. \edge [dashed,red] ..

output of code

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}        

\begin{tikzpicture}[every tree node/.style={font=\huge},
level distance=1.1cm,sibling distance=.8cm, 
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes

\Tree 
[
\edge [dashed,red] node[black,near end,left] {branch};
[   
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]        
]        
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[   
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]
\end{tikzpicture}

\end{document}
  • How can I change the style for all the edges in a tikz tree? I tried adding /.style={red, ultra thick} to the line edge from parent path= ..., but it doesn't have any effects. – havij Oct 13 '17 at 21:36
  • @havij Don't know. I'd have thought that every edge/.style={..} would work, but it didn't. – Torbjørn T. Oct 13 '17 at 22:01

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.