树形布局图中的对称性

树形布局图中的对称性

我正在学习更多关于使用 Tikz 绘制图形的知识。我正在使用 PGF3 的东西。

这个分层图布局不太好。我希望该图关于穿过顶部节点的垂直轴对称。

我所说的对称是指节点的位置要对称。边缘不能对称,文本对称当然没有意义。

图形

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard,graphdrawing,arrows}
\usegdlibrary{layered}
\usegdlibrary{trees}
\begin{document}

\begin{tikzpicture} [tree layout, 
            nodes={draw,circle, minimum width=30mm, align=center, inner sep=0.5em},
            innode/.style={draw=red, thick, dotted, inner sep=0em, scale=0.75},
            sibling distance=25mm, 
            level distance=25mm,
            thick
]

%
    \node(attack) {Shooting\\ Imminant}; 
    \node(shoot) {Ready to\\ to Shoot};
    \node(tense) {Ball Holder \\Tense};
    \node(fient) {Likely to Feint};
    \node(pass) {Teammate\\ Open\\for Pass};
    \node(rebound) {Teammate\\ Ready\\ to Catch\\ Rebound};
    \node(aiming) {Ball Holder\\Aiming};
    \node(goals) {Teammate\\ near goals};

    \node[innode](hand) {Hand Pos};
    \node[innode](head) {Head Facing};
    \node[innode](foot) {Foot Pos};
    \node[innode](team){ Team1 Positions};
    \node[innode](player){Ball Holder Pos};

    \graph{
        {(tense)}->{(shoot),(fient)};
        {(tense), (aiming)}->(shoot);
        {(pass)}->(fient);
        {(goals),(aiming)}->(rebound);
        {(rebound), (shoot),(fient)}->(attack);

        {(head),(hand),(foot)} -> {(tense)};
        {(hand),(head),(player)} -> (aiming);
        {(player),(team)} -> {(pass)};      
        {(team)} -> (goals);
    };


\end{tikzpicture}
\end{document}

答案1

主意:§27.10 使用几种不同的布局绘制单个图形

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing}
    \usegdlibrary{layered,trees}
\begin{document}
\begin{tikzpicture}[sibling distance=25mm,level distance=25mm,thick,
    nodes={draw,circle,minimum width=30mm,align=center,inner sep=0.5em},
    innode/.style={draw=red,thick,dotted,inner sep=0em,scale=0.75}]
    \graph[layered layout]{
        //[tree layout]{
            attack/Shooting\\Imminant};
        //[tree layout]{
            rebound/Teammate\\Ready\\to Catch\\Rebound,
            shoot/Ready to\\to Shoot,
            fient/Likely to Feint};
        //[tree layout]{
            goals/Teammate\\near goals,
            aiming/Ball Holder\\Aiming,
            tense/Ball Holder\\Tense,
            pass/Teammate\\Open\\for Pass};
        //[tree layout]{
            head/Head Facing[innode],
            hand/Hand Pos[innode],
            team/Team1 Positions[innode],
            player/Ball Holder Pos[innode],
            foot/Foot Pos[innode]};
        (attack)<-{(rebound),(shoot),(fient)};
        (rebound)<-{(goals),(aiming)};
        (shoot)<-{(tense),(aiming)};
        (fient)<-{(tense),(pass)};
        (goals)<-(team);
        (aiming)<-{(hand),(head),(player)};
        (tense)<-{(head),(hand),(foot)};
        (pass)<-{(player),(team)};};
\end{tikzpicture}
\end{document}

相关内容