我想要绘制如下所示的家谱图,其中终端节点与多个分支相关联。
我目前的解决方法是将我想在终端节点使用的短语分开,将分支与短语的每个部分关联起来,然后手动调整 x 值(参见 MWE)。这很复杂,也很丑陋。
\documentclass[border=10pt]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
where n children=0{tier=1}{}
[Language family, for tree={parent anchor=south, child anchor=north, l=20mm}
[(Ma, before drawing tree={x+=6.1em}]
[ny, before drawing tree={x+=4.8em}]
[su, before drawing tree={x+=3.9em}]
[bg, before drawing tree={x+=2.6em}]
[ro, before drawing tree={x+=1.3em}]
[ups)]
[Subgroup X]
[Subgroup Y]
]
\end{forest}
\end{document}
有没有简单而优雅的方法来获得我想要的东西?使用roof
不是一个选择,因为图表的重点是强调分支的数量。
答案1
由于forest
环境似乎并不意味着在同一个父级和子级之间有多条线路,所以我相信在这种情况下,tikz
这是一种更好的做法。
\documentclass[margin=2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (language family) at (0,0) {Language family};
\node (subgroup x) [below right=15mm and -15mm of language family] {Subgroup X};
\node (subgroup y) [right=5mm of subgroup x] {Subgroup Y};
\node (many subgroups) [left=5mm of subgroup x] {(Many subgroups)};
\draw (language family.south)
edge (subgroup y)
edge (subgroup x)
edge ([xshift=-12mm]many subgroups.north)
edge ([xshift=-7.2mm]many subgroups.north)
edge ([xshift=-2.4mm]many subgroups.north)
edge ([xshift=2.4mm]many subgroups.north)
edge ([xshift=7.2mm]many subgroups.north)
edge ([xshift=12mm]many subgroups.north);
\end{tikzpicture}
\end{document}