我使用它genealogytree
的目的与家谱不同,因为它可以生成美观的树。
我的问题是,当我在同一级别有许多节点时,它变得太小而无法读取。我正在尝试找到一种方法来使我的数据看起来更好。我想到的一个方法是增加一些节点的级别,但我不知道该怎么做。我还添加了一个空框(应该是一条线)来尝试修复它,但这也没有用。
我的代码:
\documentclass{article}
\usepackage{genealogytree}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{figure}[b]
\noindent\resizebox{\linewidth}{!}{
\begin{genealogypicture}[
processing=database,
database format=full,
info separators={\tcbline}{\tcbline}{}{},
category/.style={box={colback=red!20}}, % category
service/.style={box={colback=green!20}}, % a Service
realization/.style={box={colback=blue!20 }}, %Realization Technique
empty/.style={box={colback=white}}, %Realization Technique
edges={foreground={line width=1pt,black,->,},background={line width=2pt,white},}, %swing,
box={fit basedim=9pt,boxsep=2pt,segmentation style=solid,halign=center,valign=center,before upper=\parskip2pt,\gtrDBsex,{colback=gray!20}},%CATEGORY
% node={ turn=right},
after tree={
\node [draw,black,fill=red!20,text height=1em] (a) at (current bounding box.north east) {Category};
\node [draw,black,fill=green!20,left=2mm of a] (b) {Service};
\node [draw,black,fill=blue!20,left=2mm of b] (c) { Technique};
}
]
child{
g{name={\textbf{CERT \\ Services}}}
child{
g[category]{name={\textbf{React Services}}, comment= {This is performed in the software}}
child{
g[category]{name={\textbf{Linux Kernel Features}}, comment= {A feature in Linux kernel used to provide security}}
child {
g[service]{name={\textbf{Incident Analysis}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{Incident Response On-site}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{Incident Response Support}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{incident response coordination}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
}
child{
g[category]{name={\textbf{Vulnerability Handling}}, comment= {service explanation}}
child {
g[service]{name={\textbf{Vulnerability Analysis}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{Vulnerability Response}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{vulnerability Response Coordination}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
}
child{
g[category]{name={\textbf{Artifact Handling}}, comment= {Configuration automation}}
child {
g[service]{name={\textbf{Artifact Analysis}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{Artifact Response}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{Artifact Response Coordination}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
}
}
child{
g[category]{name={\textbf{Proactive Services}}, comment= {This is performed in the hardware}}
child {
g[empty]{name={\textbf{x}}}
child{
g[empty]{name={\textbf{x}}}
child {
g[empty]{name={\textbf{x}}}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
child {
g[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
c[realization]{name={\textbf{xxx}}, comment= {realization explanation}}
}
}
}
}
}
child{
g[category]{name={\textbf{Security Quality Management Services}}, comment= {This is performed in the hardware}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
c[service]{name={\textbf{xxx}}, comment= {service explanation}}
}
}
\end{genealogypicture}
}
\end{figure}
\end{landscape}
\end{document}
输出:
有什么建议么?
有没有更好的库来绘制这样的树/图?
编辑:楼主对森林解决方案有疑问将家谱树覆盖到 forrest。
答案1
您可以通过 使用“家族”名称标记图表的各个部分id
,例如
child[id=VH]
然后使用options for family
移动子树,例如
options for family={VH}{tikz={xshift=-8cm,yshift=-12cm},edge/xshift=-8cm,edge/yshift=-12cm}
通常,这将涉及您使用child
相同的标签标记所有语句。下面,我只移动了已使用 标记的子树之一VH
。您可以使用相同的想法来移动其他部分,只需为 命名即可id
。
注意我已设置name font
为\bfseries
避免多次书写\textbf
。可以使用其他选项来避免在图表中重复编码。
\documentclass{article}
\usepackage{genealogytree}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\begin{figure}[b]
\noindent\resizebox{\linewidth}{!}{
\begin{genealogypicture}[
processing=database,
database format=full,
info separators={\tcbline}{\tcbline}{}{},
category/.style={box={colback=red!20},name font=\bfseries}, % category
service/.style={box={colback=green!20},name font=\bfseries}, % a Service
realization/.style={box={colback=blue!20},name font=\bfseries}, %Realization Technique
empty/.style={box={colback=white}}, %Realization Technique
edges={foreground={line width=1pt,black,->,},background={line width=2pt,white},}, %swing,
box={fit basedim=9pt,boxsep=2pt,segmentation style=solid,halign=center,valign=center,before upper=\parskip2pt,\gtrDBsex,{colback=gray!20}},%CATEGORY
% node={ turn=right},
after tree={
\node [draw,black,fill=red!20,text height=1em] (a) at (current bounding box.north east) {Category};
\node [draw,black,fill=green!20,left=2mm of a] (b) {Service};
\node [draw,black,fill=blue!20,left=2mm of b] (c) { Technique};
},
options for family={VH}{tikz={xshift=-8cm,yshift=-12cm},edge/xshift=-8cm,edge/yshift=-12cm}
]
child{
g{name={CERT \\ Services}}
child{
g[category]{name={React Services}, comment= {This is performed in the software}}
child{
g[category]{name={Linux Kernel Features}, comment= {A feature in Linux kernel used to provide security}}
child {
g[service]{name={Incident Analysis}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={Incident Response On-site}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={Incident Response Support}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={incident response coordination}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
}
child[id=VH]{
g[category]{name={Vulnerability Handling},
comment= {service explanation}}
child[id=VH] {
g[service]{name={Vulnerability Analysis}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child[id=VH] {
g[service]{name={Vulnerability Response}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child[id=VH] {
g[service]{name={vulnerability Response Coordination}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
}
child{
g[category]{name={Artifact Handling}, comment= {Configuration automation}}
child {
g[service]{name={Artifact Analysis}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={Artifact Response}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={Artifact Response Coordination}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
}
}
child{
g[category]{name={Proactive Services}, comment= {This is performed in the hardware}}
child {
g[empty]{name={x}}
child{
g[empty]{name={x}}
child {
g[empty]{name={x}}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
child {
g[service]{name={xxx}, comment= {service explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
c[realization]{name={xxx}, comment= {realization explanation}}
}
}
}
}
}
child{
g[category]{name={Security Quality Management Services}, comment= {This is performed in the hardware}}
c[service]{name={xxx}, comment= {service explanation}}
c[service]{name={xxx}, comment= {service explanation}}
c[service]{name={xxx}, comment= {service explanation}}
c[service]{name={xxx}, comment= {service explanation}}
c[service]{name={xxx}, comment= {service explanation}}
c[service]{name={xxx}, comment= {service explanation}}
}
}
\end{genealogypicture}
}
\end{figure}
\end{landscape}
\end{document}