TikZ 思维导图布局问题

TikZ 思维导图布局问题

我创建了一个包含 4 个概念节点的思维导图,非常感谢您帮助我在 A4 纸上格式化该思维导图。

这是代码:

\documentclass[article, 12pt, oneside, a4paper]{memoir}
\usepackage{geometry}
\usepackage{tikz}

\usetikzlibrary{mindmap}
\pagestyle{empty}

\begin{document}
\begin{figure}[!h]
\resizebox{\textwidth}{!}{
\begin{tikzpicture}[
    mindmap,
    grow cyclic, text width=4cm, align=flush center,
    every node/.style={concept},
    concept color=orange!40,
    %root/.style= {concept color=black!40,font=\large\bfseries,text width=12em},
    level 1/.style={level distance=8cm,sibling angle=90},
    level 2/.style={level distance=6cm,sibling angle=45},
    level 3/.style={level distance=6cm,sibling angle=45}]

\node [root concept, scale=2] {\textbf{Root concept}}
   child [concept color=blue!30] { node {Classification}
        child { node {first classification}}
        child { node {first classification}}
        child { node {first classification}}
    }
    child [concept color=green!30] { node {One concept}
        child [concept color=green!40]{ node {description \\ of concept 1}}
       % child { node {B}}
    }
    child [concept color=yellow!30] { node {Second \\ concept}
        child { node {Environment}}
        child { node {concept two}}
        child [concept color=red!40] { node {concept \\ three}
                child { node {Description of child concept one}}  
                child { node {Description of child concept two}}
                child { node {Description of child concept three}}      
        }
    }
    child [concept color=teal!40]  { node {Other concept}
        child { node {description concept}}
        child { node {description concept}}
        child { node {description concept}}
        child { node {...}}
        child { node {...}}
    };
\end{tikzpicture}}
\caption{caption here}
\end{figure}
\end{document}

产生以下思维导图: 在此处输入图片描述

不幸的是,我需要插入一个新的概念节点,但是当我引入它时布局出现异常行为。

我的新 LaTex 代码是

\documentclass[article, 12pt, oneside, a4paper]{memoir}
\usepackage{geometry}
\usepackage{tikz}

\usetikzlibrary{mindmap}
\pagestyle{empty}

\begin{document}
\begin{figure}[!h]
\resizebox{\textwidth}{!}{
\begin{tikzpicture}[
    mindmap,
    grow cyclic, text width=4cm, align=flush center,
    every node/.style={concept},
    concept color=orange!40,
    %root/.style= {concept color=black!40,font=\large\bfseries,text width=12em},
    level 1/.style={level distance=8cm,sibling angle=90},
    level 2/.style={level distance=6cm,sibling angle=45},
    level 3/.style={level distance=6cm,sibling angle=45}]

\node [root concept, scale=2] {\textbf{Root concept}}
   child [concept color=blue!30] { node {Classification}
        child { node {first classification}}
        child { node {first classification}}
        child { node {first classification}}
    }
    child [concept color=green!30] { node {One concept}
        child [concept color=green!40]{ node {description \\ of concept 1}}
       % child { node {B}}
    }
    child [concept color=yellow!30] { node {Second \\ concept}
        child { node {Environment}}
        child { node {concept two}}
        child [concept color=red!40] { node {concept \\ three}
                child { node {Description of child concept one}}  
                child { node {Description of child concept two}}
                child { node {Description of child concept three}}      
        }
    }
    child [concept color=teal!40]  { node {Other concept}
        child { node {description concept}}
        child { node {description concept}}
        child { node {description concept}}
        child { node {...}}
        child { node {...}}
    }
  child [concept color=green!80] { node {\textbf{Five concept}}     
     child [concept color=blue!30]{ node {child concept}}

    };
\end{tikzpicture}}
\caption{caption here}
\end{figure}
\end{document}

能帮我调整一下版面吗?五个概念的位置不是没有约束的,重要的是图形保持‘视觉和谐’。

先感谢您!!!

答案1

如果您想添加第五个 1 级子级,那么您需要将角度从 90 度更改为 72 度。

level 1/.style={level distance=8cm,sibling angle=72}

在此处输入图片描述

相关内容