我有一个由许多未标记节点组成的树结构。但是,由于某种原因,这些节点比我想要的要大得多,并且似乎有一个最小大小,低于这个最小大小时,键minimum size
将被忽略:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[root/.style={draw,diamond, minimum size=1mm},
branch/.style={draw,rectangle},
leaf/.style={draw,circle, minimum size=1mm},
level 1/.style={sibling distance=5.5em, level distance=1.5em},
level 2/.style={sibling distance=2em},
level 3/.style={sibling distance=1.5em}]
\node [root] {}
child { node[branch] {}
child { node[leaf] {} }
child { node[branch] {}
child { node[leaf] {} }
child { node[leaf] {} }
}
}
child { node[branch] {}
child { node[leaf] {} }
child { node[leaf] {} }
child { node[leaf] {} }
}
child { node[branch] {}
child { node[branch] {}
child { node[leaf] {} }
child { node[leaf] {} }
child { node[leaf] {} }
}
child { node[leaf] {} }
child { node[leaf] {} }
}
child { node[branch] {}
child { node[leaf] {} }
child { node[branch] {}
child { node[leaf] {} }
child { node[leaf] {} }
}
child { node[leaf] {} }
};
\end{tikzpicture}
\end{document}
root
尽管和键的最小尺寸leaf
很小,但节点仍然相对较大。
答案1
您还需要inner sep=2pt
根据想要的大小进行调整。
因此,请按如下方式调整您的风格:
\begin{tikzpicture}[root/.style={draw,diamond, minimum size=1mm,inner sep=2pt},
branch/.style={draw,rectangle,inner sep=2pt},
leaf/.style={draw,circle, minimum size=1mm,inner sep=2pt},
level 1/.style={sibling distance=5.5em, level distance=1.5em},
level 2/.style={sibling distance=2em},
level 3/.style={sibling distance=1.5em}]
...