如何使主节点居中
How to make the make the main node in center
跟随tree我创建了一个图形。但是,主节点不在中心。此外,节点内的文本看起来很紧凑。有什么建议吗?
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\tikzset{every shadow/.style={shadow xshift=5pt,shadow yshift=-5pt}}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
man/.style={rectangle,draw,fill=gray!20},
woman/.style={rectangle,draw,fill=gray!20,rounded corners=.8ex},
grandchild/.style={grow=down,xshift=1em,anchor=west,
edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
first/.style={level distance=6ex},
second/.style={level distance=12ex},
third/.style={level distance=18ex},
fourth/.style={level distance=24ex},
fourth/.style={level distance=24ex},
fifth/.style={level distance=29ex},
level 1/.style={sibling distance=15em}]
% Parents
\coordinate
child[grow=0ex] {node[man,anchor=south]{Challenges:Blockchain-based Digital Twins}}
child[grow=down,level distance=0ex]
[edge from parent fork down]
child{node[man]
{Technical Challenges}
child[grandchild,first] {node[woman]{High-fidelity Models}}
child[grandchild,second] {node[woman]{Data-related Issues}}
child[grandchild,third] {node[woman] {Model Challenges}}
child[grandchild,fourth] {node[woman] {Uncertain Events}}
child[grandchild,fifth] {node[woman] {Interoperability}}
}
child{node[man]
{Logistical Challenges}
child[grandchild,first] {node[woman]{Standardization Barriers}}
child[grandchild,second] {node[woman]{Scattered Ownership of Data}}
child[grandchild,third] {node[woman] {Infrastructure Cost}}
child[grandchild,fourth] {node[woman] {Skepticism in Blockchain}}
}
child{node[man]
{Social Challenges}
child[grandchild,first] {node[woman]{Ethical and Moral Issues}}
child[grandchild,second] {node[woman]{Environmental Issues}}
child[grandchild,third] {node[woman] {Lack of Collaboration}}
child[grandchild,fourth] {node[woman] {Lack of Sharing Sensitive Information}}
};
\end{tikzpicture}
\end{document}
链接示例需要使用此 \ccordinate
hack,因为它不是具有一个父节点的典型树。
无论你的情况如何,你都可以简单地从一个节点开始,然后它会自动居中:
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\tikzset{every shadow/.style={shadow xshift=5pt,shadow yshift=-5pt}}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
man/.style={rectangle,draw,fill=gray!20},
woman/.style={rectangle,draw,fill=gray!20,rounded corners=.8ex},
grandchild/.style={grow=down,xshift=1em,anchor=west,
edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
first/.style={level distance=6ex},
second/.style={level distance=12ex},
third/.style={level distance=18ex},
fourth/.style={level distance=24ex},
fourth/.style={level distance=24ex},
fifth/.style={level distance=29ex},
level 1/.style={sibling distance=15em}]
% Parents
\node[man] {Challenges:Blockchain-based Digital Twins}
child[grow=down,level distance=2ex]
[edge from parent fork down]
child{node[man]
{Technical Challenges}
child[grandchild,first] {node[woman]{High-fidelity Models}}
child[grandchild,second] {node[woman]{Data-related Issues}}
child[grandchild,third] {node[woman] {Model Challenges}}
child[grandchild,fourth] {node[woman] {Uncertain Events}}
child[grandchild,fifth] {node[woman] {Interoperability}}
}
child{node[man]
{Logistical Challenges}
child[grandchild,first] {node[woman]{Standardization Barriers}}
child[grandchild,second] {node[woman]{Scattered Ownership of Data}}
child[grandchild,third] {node[woman] {Infrastructure Cost}}
child[grandchild,fourth] {node[woman] {Skepticism in Blockchain}}
}
child{node[man]
{Social Challenges}
child[grandchild,first] {node[woman]{Ethical and Moral Issues}}
child[grandchild,second] {node[woman]{Environmental Issues}}
child[grandchild,third] {node[woman] {Lack of Collaboration}}
child[grandchild,fourth] {node[woman] {Lack of Sharing Sensitive Information}}
};
\end{tikzpicture}
\end{document}
跟随tree我创建了一个图形。但是,主节点不在中心。此外,节点内的文本看起来很紧凑。有什么建议吗?
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\tikzset{every shadow/.style={shadow xshift=5pt,shadow yshift=-5pt}}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
man/.style={rectangle,draw,fill=gray!20},
woman/.style={rectangle,draw,fill=gray!20,rounded corners=.8ex},
grandchild/.style={grow=down,xshift=1em,anchor=west,
edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
first/.style={level distance=6ex},
second/.style={level distance=12ex},
third/.style={level distance=18ex},
fourth/.style={level distance=24ex},
fourth/.style={level distance=24ex},
fifth/.style={level distance=29ex},
level 1/.style={sibling distance=15em}]
% Parents
\coordinate
child[grow=0ex] {node[man,anchor=south]{Challenges:Blockchain-based Digital Twins}}
child[grow=down,level distance=0ex]
[edge from parent fork down]
child{node[man]
{Technical Challenges}
child[grandchild,first] {node[woman]{High-fidelity Models}}
child[grandchild,second] {node[woman]{Data-related Issues}}
child[grandchild,third] {node[woman] {Model Challenges}}
child[grandchild,fourth] {node[woman] {Uncertain Events}}
child[grandchild,fifth] {node[woman] {Interoperability}}
}
child{node[man]
{Logistical Challenges}
child[grandchild,first] {node[woman]{Standardization Barriers}}
child[grandchild,second] {node[woman]{Scattered Ownership of Data}}
child[grandchild,third] {node[woman] {Infrastructure Cost}}
child[grandchild,fourth] {node[woman] {Skepticism in Blockchain}}
}
child{node[man]
{Social Challenges}
child[grandchild,first] {node[woman]{Ethical and Moral Issues}}
child[grandchild,second] {node[woman]{Environmental Issues}}
child[grandchild,third] {node[woman] {Lack of Collaboration}}
child[grandchild,fourth] {node[woman] {Lack of Sharing Sensitive Information}}
};
\end{tikzpicture}
\end{document}
链接示例需要使用此 \ccordinate
hack,因为它不是具有一个父节点的典型树。
无论你的情况如何,你都可以简单地从一个节点开始,然后它会自动居中:
\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shadows}
\tikzset{every shadow/.style={shadow xshift=5pt,shadow yshift=-5pt}}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
man/.style={rectangle,draw,fill=gray!20},
woman/.style={rectangle,draw,fill=gray!20,rounded corners=.8ex},
grandchild/.style={grow=down,xshift=1em,anchor=west,
edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}},
first/.style={level distance=6ex},
second/.style={level distance=12ex},
third/.style={level distance=18ex},
fourth/.style={level distance=24ex},
fourth/.style={level distance=24ex},
fifth/.style={level distance=29ex},
level 1/.style={sibling distance=15em}]
% Parents
\node[man] {Challenges:Blockchain-based Digital Twins}
child[grow=down,level distance=2ex]
[edge from parent fork down]
child{node[man]
{Technical Challenges}
child[grandchild,first] {node[woman]{High-fidelity Models}}
child[grandchild,second] {node[woman]{Data-related Issues}}
child[grandchild,third] {node[woman] {Model Challenges}}
child[grandchild,fourth] {node[woman] {Uncertain Events}}
child[grandchild,fifth] {node[woman] {Interoperability}}
}
child{node[man]
{Logistical Challenges}
child[grandchild,first] {node[woman]{Standardization Barriers}}
child[grandchild,second] {node[woman]{Scattered Ownership of Data}}
child[grandchild,third] {node[woman] {Infrastructure Cost}}
child[grandchild,fourth] {node[woman] {Skepticism in Blockchain}}
}
child{node[man]
{Social Challenges}
child[grandchild,first] {node[woman]{Ethical and Moral Issues}}
child[grandchild,second] {node[woman]{Environmental Issues}}
child[grandchild,third] {node[woman] {Lack of Collaboration}}
child[grandchild,fourth] {node[woman] {Lack of Sharing Sensitive Information}}
};
\end{tikzpicture}
\end{document}