Leaf nodes in tikz-qtree are not aligned with parents when using grow=left

It seems that tikz-qtree aligns the base anchor of the leaf nodes with the corresponding parent node if there is only one branch. Then, it draws the branch connecting the parent node to the center anchor of the leaf node. This works for vertical trees, but causes misalignment for horizontal trees.

To solve this, add

every leaf node/.append style={anchor=center}

to the options of your tikzpicture.

\documentclass[12pt, a4paper]{article}
\usepackage{tikz-qtree}

\begin{document}

\begin{figure}[ht]
\centering
\begin{tikzpicture}[grow=left, sibling distance=5pt, rotate=90, transform shape, every leaf node/.append style={anchor=center}]
\tikzset{frontier/.style={distance from root=275pt}}
\Tree [ 
    [tip1 ]
    [
        [tip2 ]
        [
            [
                [tip3 ]
                [
                    [
                        [tip4 ]
                        [
                            [tip5 ]
                            [tip6 ]
                        ]
                    ]
                    [
                        [
                            [tip7 ]
                            [tip8 ]
                        ]
                        [
                            [
                                [tip9 ]
                                [tip10 ]
                            ]
                            [
                                [tip11 ]
                                [tip12 ]
                            ]
                        ]
                    ]
                ]
            ]
            [
                [tip13 ]
                [
                    [tip14 ]
                    [
                        [
                            [tip15 ]
                            [tip16 ]
                        ]
                        [
                            [
                                [tip17 ]
                                [tip18 ]
                            ]
                            [
                                [tip19 ]
                                [tip20 ]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
]
\end{tikzpicture}
\caption{Dendogram}
\label{fig:dendogram}
\end{figure}

\end{document}

enter image description here


hm, your dendogram can be translated to forest as:

\documentclass[12pt, a4paper]{article}
\usepackage{forest}

\begin{document}
    \begin{figure}[ht]
\centering
\begin{forest}
for tree = {
    s sep=0pt,
    if n children=0{rotate=90,anchor=east,tier=word}%
                   {coordinate}
            }
[
    [[tip1]]
    [
        [[tip2]]
        [
            [
                [[tip3]]
                [
                    [
                        [[tip4]]
                        [
                            [[tip5]]
                            [[tip6]]
                        ]
                    ]
                    [
                        [
                            [[tip7]]
                            [[tip8]]
                        ]
                        [
                            [
                                [[tip9]]
                                [[tip10]]
                            ]
                            [
                                [[tip11]]
                                [[tip12]]
                            ]
                        ]
                    ]
                ]
            ]
            [
                [[tip13]]
                [
                    [[tip14]]
                    [
                        [
                            [[tip15]]
                            [[tip16]]
                        ]
                        [
                            [
                                [[tip17]]
                                [[tip18]]
                            ]
                            [
                                [[tip19]]
                                [[tip20]]
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
]
\end{forest}
\caption{Dendogram}
\label{fig:dendogram}
    \end{figure}
\end{document}

enter image description here

Tags:

Tikz Qtree