\documentclass[tikz, crop, border=5pt]{standalone} \usetikzlibrary{positioning,backgrounds,fit} \usepackage{forest} \usepackage{fontspec,xltxtra,xunicode} %STYLE_BEGIN% % English Fonts \setmainfont[BoldFont={Fira Sans}]{Fira Sans Light} % 中文字体 \usepackage{xeCJK} \setCJKmainfont[BoldFont=Source Han Sans SC Medium]{Source Han Sans SC Normal} \xeCJKsetup{CJKecglue = {\hskip 0pt plus 0.08\baselineskip}, xCJKecglue = {false}} \punctstyle{plain} \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} %STYLE_END% % Avoid using xcolor dvipsnames % https://en.wikibooks.org/wiki/LaTeX/Colors % https://www.color-hex.com/ \definecolor{black}{RGB}{26,25,25} \definecolor{grey}{RGB}{129,130,132} \definecolor{red}{RGB}{188,36,46} \definecolor{brown}{RGB}{121,37,0} \definecolor{green}{RGB}{32,128,108} \definecolor{purple}{RGB}{160,90,150} \definecolor{blue}{RGB}{0,103,149} % MidnightBlue % Upper case colors for backgrounds % https://coolors.co/palette/fbf8cc-fde4cf-ffcfd2-f1c0e8-cfbaf0-a3c4f3-90dbf4-8eecf5-98f5e1-b9fbc0 \definecolor{LemonChiffon}{RGB}{251, 248, 204} \definecolor{ChampagnePink}{RGB}{253, 228, 207} \definecolor{TeaRose}{RGB}{255, 207, 210} \definecolor{PinkLavender}{RGB}{241, 192, 232} \definecolor{Mauve}{RGB}{207, 186, 240} \definecolor{JordyBlue}{RGB}{163, 196, 243} \definecolor{NonPhotoBlue}{RGB}{144, 219, 244} \definecolor{ElectricBlue}{RGB}{142, 236, 245} \definecolor{Aquamarine}{RGB}{152, 245, 225} \definecolor{Celadon}{RGB}{185, 251, 192} \tikzset{ comment/.append style={label={[font=\small]0:#1}}, } \forestset{ /tikz/label position=below left, /tikz/label distance=.1em, dot/.style={tikz+={\fill[fill=#1] (.child anchor) circle[radius=2pt];}}, dot/.default=black, bar/.style={tikz+={\draw[color=#1,line width=2pt] let \p1 = (!u.parent anchor), \p2 = (.child anchor) in ($(\x1, \y2 - 0.5em)!0.5!(\x2, \y2)$) -- ($(\x1, \y2 + 0.5em)!0.5!(\x2, \y2)$);}}, bar/.default=black, rec/.style={tikz+={\scoped[on background layer]{ \node[draw=none, fill=#1, rectangle, fit to=tree, inner sep=-2pt, ] {};} }}, rec/.default=Thistle, } \begin{document} \begin{forest} where n children=0{tier=word}{}, for tree={ s sep=-4pt, % make siblings closer grow=0, % 0 degrees is to the right reversed, % tree_direction align=left, parent anchor=east, child anchor=west, anchor=west, edge path={ \noexpand\path[draw, grey, line width=1pt, \forestoption{edge}] (!u.parent anchor) |- (.child anchor)\forestoption{edge label}; }, before typesetting nodes={ if content={}{shape=coordinate}{} }, } [, label=\color{green}{动物}, dot [{栉水母}, comment=192] [, dot=red [\color{green}{多孔动物}, comment=8579] [, label={Parahoxozoa}, dot=red [{扁盘动物}, comment=1] [, label={Planulozoa}, dot=red [\color{green}{刺胞动物}, comment=13138] [, label=\color{green}{两侧对称动物}, dot [{异无腔动物}, comment=380] [, label={Nephrozoa}, dot=red [, label=\color{green}{后口动物}, tier=3, dot=red [\color{green}{棘皮动物}, comment=7330] [, label=\color{green}{脊索动物}, tier=2, dot [\color{green}{头索动物}, comment=33] [ [\color{green}{尾索动物}, comment=3020] [\color{green}{有头动物}, comment=64832] ] ] ] [, label=\color{green}{原口动物}, tier=4, dot [, label={螺旋卵裂动物}, tier=3, dot [ [, label={担轮动物}, tier=2, dot=red [\color{green}{环节动物}, comment=21707] [\color{green}{软体动物}, comment=74374] ] ] [\color{green}{扁形动物}, comment=29285] ] [, label=\color{green}{蜕皮动物}, dot [\color{green}{线虫动物}, comment=24773] [\color{green}{节肢动物}, comment={>1200000}] ] ] ] ] ] ] ] ] %FOREST_END% \end{forest} \end{document}