更改 tikz-qtree 中单个分支的样式

更改 tikz-qtree 中单个分支的样式

a我怎样才能改变仅一个分支的颜色和样式(如虚线或点线),比如说和的父级和祖级之间的分支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}

答案1

正如你已经\edge在任何地方所做的那样,这只是一个做事的问题\edge [dashed,red] ..

代码输出

\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}

相关内容