使用“从父级分叉向下”时文本边缘出现问题

使用“从父级分叉向下”时文本边缘出现问题

我正在使用 tikz 来描绘决策树,但出现了一些问题:一些线条被绘制在文本上方(见下图)

在此处输入图片描述

这是我正在使用的代码:

\begin{tikzpicture}
[
    level distance = 3cm,
    sibling distance = 4.5cm,
    every node/.append style = {draw},
    edge from parent fork down
]
\node{\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 33.8\% & 1510\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 66.2\% & 2957 \end{tabular}}
    % Node 1
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 13.9\% & 78\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 86.1\% & 482 \end{tabular}} edge from parent node [fill=white,draw=none] {$\leq 28.360$}}
    % Node 2
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 5.6\% & 16\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 94.4\% & 268 \end{tabular}} edge from parent node [fill=white,draw=none] {$\in(28.360,28.510]$}}
    % Node 3
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 17.5\% & 244\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 82.5\% & 1150 \end{tabular}}
        % Node 8
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 15.1\% & 43\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 84.9\% & 241 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$\leq 20.780$}}
        % Node 9
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 24.4\% & 68\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 75.6\% & 211 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$\in(20.780,21.170]$}}
        % Node 10
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 16.0\% & 133\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 84\% & 698 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$>21.170$}}
        edge from parent node [fill=white,draw=none] {$\in(28.510,32.490]$}
    }
    % Node 4
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 27.5\% & 155\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 72.5\% & 408 \end{tabular}} edge from parent node [fill=white,draw=none] {$\in(32.490,37.290]$}}
    % Node 5
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 41.6\% & 116\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 58.4\% & 163 \end{tabular}} edge from parent node [fill=white,draw=none] {$\in(37.290,40.010]$}}
    % Node 6
    child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 57.8\% & 480\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 42.2\% & 350 \end{tabular}}
        % Node 11
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 41.9\% & 116\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 58.1\% & 161 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$\leq 27.710$}}
        % Node 12
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 58.3\% & 161\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 41.7\% & 115 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$\in(27.710,28.620]$}}
        % Node 13
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 73.3\% & 203\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 26.7\% & 74 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$>28.620$}}
        edge from parent node [fill=white,draw=none] {$\in(40.010,50.640]$}
    }
    % Node 7
    child {node [right=4.8cm] {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 75.6\% & 421\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 24.4\% & 136 \end{tabular}}
        % Node 14
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 67.4\% & 188\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 32.6\% & 91 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$\leq 28.380$}}
        % Node 15
        child {node {\begin{tabular}{lll} {\footnotesize\color{blue}$\blacklozenge$}\,Large & 83.8\% & 233\\{\footnotesize\color{red}$\blacklozenge$}\,Small & 16.2\% & 45 \end{tabular}}
        edge from parent node [fill=white,draw=none] {$> 28.380$}}
        edge from parent node [fill=white,draw=none] {$>50.640$}
    };
\end{tikzpicture}

我怎样才能解决这个问题?

谢谢!

法比奥

相关内容