我想使用 tikz 创建一棵树。但是,我有一些限制。所有级别的大多数节点都是标准的常用节点。但是,我希望在这棵树的某个级别(比如第 3 级)有以下内容:
- 这个级别的所有节点都应该画得更大(也许是椭圆形)。
- 此外,我还希望每个大节点都包含一些点。在下图中,我用紫色标记了这些点。这些紫色点有一个“家”节点,它们中的大多数都住在那里。其中一些紫色点出现在这一级别的其他节点中。
我可以添加从网上获得的 tikz 代码来创建树,但它非常简单。如果这对解决这个问题有帮助,请告诉我。
编辑(稍后添加)
以下是我迄今为止在 overleaf 上尝试过的一些变体。大部分都是围绕定义一些新节点对象的尝试。但我最终得到的图片并不是特别好看。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes.gates.logic.US,trees,positioning,arrows}
\tikzset{
standard/.style = {circle, white, draw=black, inner sep = 1.5},
containerNode/.style={circle, draw=black, minimum size=1cm, node contents=\draw \Huge $\dots$ $\dots$ $\dots$},
}
\begin{document}
\begin{figure*}[t!]
\centering
\scalebox{.6}{
\begin{tikzpicture}[level/.style={sibling distance=60mm/#1,level distance = 2cm}]
\node [standard] (z){}
child {node [standard] {}edge from parent [draw=black, very thin]
child {node [standard] {}edge from parent [draw=black,very thin]
child {node [standard] {}edge from parent [draw=black,very thin]}
child {node [standard] {}edge from parent [draw=black,very thin]}
}
child {node [standard] {}edge from parent [draw=black, very thin]
child {node [containerNode] (a) {}edge from parent [draw=black, very thin]
child {node [standard] (x) {}edge from parent[draw=black, very thin]}
child {node [standard] (y) {}edge from parent[draw=black, very thin]}
}
child {node [standard] {}edge from parent [draw=black,very thin]}
}
}
child { node [standard] {} edge from parent [draw=black, very thin]
child {node [standard] {}edge from parent [draw=black, very thin]
child {node [standard] {}edge from parent [draw=black,very thin]
}
child {node [standard] (b) {}edge from parent [draw=black, very thin]}
}
child {node [standard] {}edge from parent [draw=black, very thin]
child {node [standard] (c){}edge from parent [draw=black, very thin]}
child {node [standard] {} edge from parent [draw=black,very thin]}
}
};
\end{tikzpicture}
}
\end{figure*}
\end{document}
背面生成的图像显示如下。
道歉因为添加编辑内容的时间太长了。