我使用在这里找到的代码绘制层次树图
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={
align=center,
font=\sffamily,
edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[Angiography Based On Medical Imaging Modalities
[Biplane\\X-Ray/DSA]
[Magnetic\\Resonance
[Contrast Enhanced]
[Non-Contrast Enhanced
[Time of Flight]
[Black-Blood]
[Phase Contrast]
[T2]
[T2\textsuperscript{*}]
]
]
[Computed-\\Tomography, calign with current]
[Ultrasound]
[Fusion of\\Modalities]
]
\end{forest}
\end{document}
产生
我应该如何修改代码才能得到如下结果
非常感谢!
编辑
MWE 创建前三个级别:
\documentclass[tikz,french]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={
align=center,
font=\sffamily,
edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[{\bf Question:} Quels sont les facteurs contribuant à des taux d'échec\\élevés en cours de mécanique de première année?
[Qu'est-ce\\qui a déjà\\été fait?
[Revue de\\littérature]
]
[Cours typique\\en mécanique\\de 1e année?
[``Benchmarking''\\de cours]
]
[Sujets\\probléma-\\tiques?
[Analyser\\ le travail\\
des étudiants]
]
[Où le problème\\pourrait-il\\commencer?
[Analyser\\le dossier\\
universitaire]
]
]
\end{forest}
\end{document}
我不知道如何包含从第三级(从上面开始枚举)发出的第四级。
答案1
图表的结构非常不同,但如果您想要绘制边界并使所有节点具有相同的高度(在第 1 级),您可能只需添加 draw,其中 level=1{minimum height=8ex,anchor=north}{},
梅威瑟:
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={draw,
where level=1{minimum height=8ex,anchor=north}{},
align=center,
font=\sffamily,
edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[Angiography Based On Medical Imaging Modalities
[Biplane\\X-Ray/DSA]
[Magnetic\\Resonance
[Contrast Enhanced]
[Non-Contrast Enhanced
[Time of Flight]
[Black-Blood]
[Phase Contrast]
[T2]
[T2\textsuperscript{*}]
]
]
[Computed-\\Tomography, calign with current]
[Ultrasound]
[Fusion of\\Modalities]
]
\end{forest}
\end{document}
Ultrasound
或者在节点中添加一个空行
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
for tree={draw,
align=center,
font=\sffamily,
edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[Angiography Based On Medical Imaging Modalities
[Biplane\\X-Ray/DSA]
[Magnetic\\Resonance
[Contrast Enhanced]
[Non-Contrast Enhanced
[Time of Flight]
[Black-Blood]
[Phase Contrast]
[T2]
[T2\textsuperscript{*}]
]
]
[Computed-\\Tomography, calign with current]
[Ultrasound\\~]
[Fusion of\\Modalities]
]
\end{forest}
\end{document}
至于你对这个问题的补充:
\documentclass[tikz,french]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,positioning}
\begin{document}
\begin{forest}
for tree={
align=center,
font=\sffamily,
edge+={thick, -{Stealth[]}},
l sep'+=10pt,
fork sep'=10pt,
},
forked edges,
if level=0{
inner xsep=0pt,
tikz={\draw [thick] (.children first) -- (.children last);}
}{},
[{\bf Question:} Quels sont les facteurs contribuant à des taux d'échec\\élevés en cours de mécanique de première année?
[Qu'est-ce\\qui a déjà\\été fait?
[Revue de\\littérature,alias=A1]
]
[Cours typique\\en mécanique\\de 1e année?
[``Benchmarking''\\de cours,alias=A2]
]
[Sujets\\probléma-\\tiques?
[Analyser\\ le travail\\
des étudiants,alias=A3]
]
[Où le problème\\pourrait-il\\commencer?
[Analyser\\le dossier\\
universitaire,alias=A4]
]
]
\path (A3.south) -- (A2|-A3.south) coordinate[midway,below=10pt] (aux);
\node[anchor=north,below=15pt of aux] (D) {Dimitris};
\foreach \X in {1,...,4}
{\draw[thick, -{Stealth[]}] (A\X) |- (aux) -- (D);}
\end{forest}
\end{document}