TiKZ 树没有按预期生长

TiKZ 树没有按预期生长

我有这个代码:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{mindmap}


\begin{document}


    \begin{tikzpicture}[text width=2.7cm, 
        align=flush center,
        grow cyclic,
        level 1/.style={level distance=5cm,sibling angle=180},
        level 2/.style={level distance=3cm,sibling angle=45}
    ]


        \node{28 Days Later (2003)}
            child { node {Ancestors} }
                child { node {Night of the Living Dead (1968) } }
                child { node {The Omega Man (1970) } }
                child { node {The Day of the Triffids (1959) } }
                child { node {I Am Legend (1954) } }
                child { node {The War of the Worlds (1894) } }
            child { node {Descendants} }
                child { node {The Girl With All the Gifts (2016) } }
                child { node {The Walking Dead (2012) } }
                child { node {World War Z (2013) } }
                child { node {FEMA Emergency Preparedness Guide (2019) } } 
        ;
    
    \end{tikzpicture}

\end{document}

一级分支按预期散开,但二级分支却没有:

在此处输入图片描述

我应该做些什么不同的事情?

答案1

您对地图的括号嵌套并不完全正确,我做了更正,但有点不确定您想要祖先/后代到底在哪里......

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{mindmap}


\begin{document}


    \begin{tikzpicture}[
        text width=2.7cm, 
        align=flush center,
        grow cyclic,
        level 1/.style={level distance=1.5cm,sibling angle=180},
        level 2/.style={level distance=3cm,sibling angle=45}
    ]

        \node{28 Days Later (2003)}
            child { 
                child { node {The Girl With All the Gifts (2016) } }
                child { node {The Walking Dead (2012) } }
                child { node {World War Z (2013) } }
                child { node {FEMA Emergency Preparedness Guide (2019) } } 
            }
            child { 
                child { node {Night of the Living Dead (1968) } }
                child { node {The Omega Man (1970) } }
                child { node {The Day of the Triffids (1959) } }
                child { node {I Am Legend (1954) } }
                child { node {The War of the Worlds (1894) } }
            }
            ;
    
    \end{tikzpicture}

\end{document}

这产生了 预览

相关内容