绘制系统发育树

绘制系统发育树

我正在尝试生成一棵树,如下所示: 在此处输入图片描述

这是我目前的代码:

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}        

\begin{tikzpicture}[every tree node/.style={font=\huge},
level distance=1.1cm,sibling distance=.8cm, 
edge from parent path={(\tikzparentnode.south) -- +(0,-8pt) -| (\tikzchildnode)}],
frontier/.style={distance from root=350pt} % Align leaf nodes

\Tree 
[
\edge node[near end,left] {branch};
[   
\edge node[near end, left] {};
[
\edge node[] {}; [.a ]
\edge node[] {}; [.b ]        
]        
\edge node[] {}; [.c ]
]
\edge node[near end,right] {};
[   
\edge node[] {}; [.d ]
\edge node[] {}; [.e ]
]
]
\node[draw] at (0,.2) {root};
\draw (1.6,-1.9) circle (1.3cm);
\draw[thick,->] (0,-4.5) -- (1,-3.2);
\node[draw] at (0,-5) {clade};
\end{tikzpicture}

\end{document}

生成以下内容(PDFLaTex):

在此处输入图片描述

我的问题是:

  1. 如何让所有的叶子出现在同一个水平面上?
  2. 除了手动定位树上的位置之外,有没有更好的绘制圆圈的方法?
  3. 如何让树水平?

答案1

您可以使用该fit库将节点适配到一组命名节点中。如果您使用 Forest 绘制树,它会提供fit to=<nodewalk>包装器来简化此操作。

例如,

分支和事物

\documentclass[border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shapes.geometric,arrows.meta}
\begin{document}
\begin{forest}
  forked edges,
  /tikz/every pin edge/.append style={Latex-, shorten <=2.5pt, darkgray},
  /tikz/every pin/.append style={darkgray, font=\sffamily},
  /tikz/every label/.append style={darkgray, font=\sffamily},
  before typesetting nodes={
    delay={
      where content={}{coordinate}{},
    },
    where n children=0{tier=terminus, label/.process={Ow{content}{right:#1}}, content=}{},
  },
  for tree={
    grow'=0,
    s sep'+=10pt,
    l sep'+=15pt,
  },
  l sep'+=50pt,
  tikz+={
    \node [draw=blue, circle, ellipse, densely dashed, fit to={1,tree}, pin={[pin distance=50pt,name=clades]-40:clades}] {};
    \node (p) [draw=blue, circle, ellipse, densely dashed, fit to={l,tree}] {};
    \draw [every pin edge] (p) -- (clades);
  }
  [, !l.edge label={coordinate [pos=0, pin=-135:root] }, !1.edge label={node [pos=.65, every label, above] {branch}}, !11.edge label={coordinate [pos=0, pin={[pin distance=30pt, align=center]135:internal\\node}] }
    [
      [
        [tip (terminal node)]
        [b]
      ]
      [c]
    ]
    [[d][e]]
  ]
\end{forest}

\end{document}

相关内容