Tikz-\graph命令明确将一个父节点放置在另一个父节点下方(连接到同一个子节点)

Tikz-\graph命令明确将一个父节点放置在另一个父节点下方(连接到同一个子节点)

在下面Tikz使用构造自动放置图形\graph(即,而不是使用fit库放置节点)专门构建的流程图中,

这里

我怎样才能拥有节点 X以下节点 $\gamma$?除法工作流程需要这样做才能在数学上正确。

以下是我的LuaTeX代码:

\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, graphs, shapes, calc, arrows.meta, intersections}
\usetikzlibrary{graphdrawing}
\usegdlibrary{trees,layered,force}
\usepackage{mathtools}

\begin{document}
\begin{figure}
\begin{tikzpicture}[
    regularnode/.style={draw,semithick, minimum width = 12mm, minimum height = 8mm},
    sumnode/.style={draw,circle,semithick},
    gainnode/.style={draw,isosceles triangle,semithick},
    stylenode/.style={draw,semithick, minimum width = 1.2cm, minimum height = 1cm, node distance=4mm and 1.3cm},
    styledecisionbox/.style={draw,semithick,shape aspect=1,diamond,inner sep=2pt},
    >=Stealth,auto
    ]

    \graph [layered layout,grow=right,level sep=1cm]
    {
        {"power"/"1"[regularnode],"dragpower"/"2"[regularnode],"rollpower"/"3"[regularnode],"gradpower"/"4"[regularnode]}
        -> "sumofpowers"/"$\Sigma$"[sumnode]
        ->  "scalebydteff"/"$\alpha$" [gainnode]
        ->  "powerselector"/"$\beta$" [regularnode]
        ->  "scalebyncells"/"$\gamma$" [gainnode]
        ->  "scalebysurfacearea"/"$\div$" [stylenode]
        ->  "lionsimba"/"d"  [align=center,stylenode];
        ;
        "surfaceareacalc"/"X"[red,minimum size=1cm,circle,draw,ultra thick,fill=green!40]-> scalebysurfacearea;
    };

\end{tikzpicture}
\end{figure}
\end{document}

答案1

用来改变子项的顺序grow'=rightgrow=right

\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, graphs, shapes, calc, arrows.meta, intersections}
\usetikzlibrary{graphdrawing}
\usegdlibrary{trees,layered,force}
\usepackage{mathtools}

\begin{document}
%\begin{figure}
\begin{tikzpicture}[
    regularnode/.style={draw,semithick, minimum width = 12mm, minimum height = 8mm},
    sumnode/.style={draw,circle,semithick},
    gainnode/.style={draw,isosceles triangle,semithick},
    stylenode/.style={draw,semithick, minimum width = 1.2cm, minimum height = 1cm, node distance=4mm and 1.3cm},
    styledecisionbox/.style={draw,semithick,shape aspect=1,diamond,inner sep=2pt},
    >=Stealth,auto
    ]

    \graph [layered layout,grow'=right,level sep=1cm]
    {
        {"power"/"1"[regularnode],"dragpower"/"2"[regularnode],"rollpower"/"3"[regularnode],"gradpower"/"4"[regularnode]}
        -> "sumofpowers"/"$\Sigma$"[sumnode]
        ->  "scalebydteff"/"$\alpha$" [gainnode]
        ->  "powerselector"/"$\beta$" [regularnode]
        ->  "scalebyncells"/"$\gamma$" [gainnode]
        ->  "scalebysurfacearea"/"$\div$" [stylenode]
        ->  "lionsimba"/"d"  [align=center,stylenode];
        ;
        "surfaceareacalc"/"X"[red,minimum size=1cm,circle,draw,ultra thick,fill=green!40]
        -> scalebysurfacearea
        ;
    };

\end{tikzpicture}
%\end{figure}
\end{document}

结果:

在此处输入图片描述

但请注意,“1”、“2”、“3”和“4”的顺序也发生了变化。

相关内容