垂直对齐 Tikz 节点

垂直对齐 Tikz 节点

我正在尝试使用 创建图表Tikz。以下是我目前拥有的简短版本: 在此处输入图片描述

我想要做的是将“二级主题”和“聚合维度”下的节点垂直居中,与前面的节点相对。例如,我想将“组织”置于“基于平台的组织”和“调整组织结构”之间。同样,我想将“调整组织结构”置于“根据项目创建单元团队”和“决策分散化”之间。我该怎么做?这是 MWE:

\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, positioning}
\tikzstyle{arrow}=[draw, -latex]
\begin{document}

\definecolor{747aec21-333b-59ee-84e3-ddff893e5ccd}{RGB}{255, 216, 176}
\definecolor{f3551e38-74df-57e2-b793-83d7fe876c85}{RGB}{0, 0, 0}
\definecolor{0b71a967-1f15-55a5-9bb9-70efa7b4fc58}{RGB}{51, 51, 51}

\tikzstyle{69bbb168-da59-5865-902f-94e77902bf95} = [rectangle, text width=6cm, minimum height=1cm, text centered, font=\normalsize, color=0b71a967-1f15-55a5-9bb9-70efa7b4fc58, draw=f3551e38-74df-57e2-b793-83d7fe876c85, line width=1, fill=747aec21-333b-59ee-84e3-ddff893e5ccd]

\begin{tikzpicture}[node distance=1.3cm]
\node (zb) [69bbb168-da59-5865-902f-94e77902bf95,fill=yellow] {First-order concepts};
\node (zc) [69bbb168-da59-5865-902f-94e77902bf95, right of=zb, xshift=6cm, text width=3cm,fill=yellow] {Second-order themes};
\node (zd) [69bbb168-da59-5865-902f-94e77902bf95,, right of=zc, xshift=4cm, text width=2cm,fill=yellow] {Aggregate dimensions};
\node (a) [69bbb168-da59-5865-902f-94e77902bf95, below of=zb] {Creation of resources (apps, APIs, SDKs, mini-apps)};
\node (b) [69bbb168-da59-5865-902f-94e77902bf95, below of=a] {Transforming structure of organizing business (from app on SIM to app on smartphone)};
\node (c) [69bbb168-da59-5865-902f-94e77902bf95, below of=b] {Onboarding users and complementors on the app};
\node (d) [69bbb168-da59-5865-902f-94e77902bf95, right of=b, xshift=6cm, text width=3cm] {Platform-based organizing};
\node (e) [69bbb168-da59-5865-902f-94e77902bf95, right of=d, xshift=4cm, text width=2cm] {Organizing};
\draw [arrow] (a) -- (d);
\draw [arrow] (b) -- (d);
\draw [arrow] (c) -- (d);
\draw [arrow] (d) -- (e);
\node (f) [69bbb168-da59-5865-902f-94e77902bf95, below of =c] {Cell teams are created based on projects};
\node (g) [69bbb168-da59-5865-902f-94e77902bf95, below of=f] {Decentralisation of decision making};
\node (h) [69bbb168-da59-5865-902f-94e77902bf95, right of=g, xshift=6cm, text width=3cm] {Adapting organization structure};
\draw [arrow] (f) -- (h);
\draw [arrow] (g) -- (h);
\draw [arrow] (h) -- (e);

\end{tikzpicture}

\end{document} 

答案1

calc一种方法是将库与库一起使用positioning。您当前的代码不使用增强的<direction>=<dimension> of <position>,但如果使用,会更容易一些。此外,\tikzstyle已过时,应在新代码中避免使用。

所以也许是这样的?

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{shapes.geometric, arrows, positioning,calc}
\tikzset{arrow/.style={draw, -latex}}
\begin{document}

\definecolor{747aec21-333b-59ee-84e3-ddff893e5ccd}{RGB}{255, 216, 176}
\definecolor{f3551e38-74df-57e2-b793-83d7fe876c85}{RGB}{0, 0, 0}
\definecolor{0b71a967-1f15-55a5-9bb9-70efa7b4fc58}{RGB}{51, 51, 51}

\tikzset{69bbb168-da59-5865-902f-94e77902bf95/.style={rectangle, text width=6cm, minimum height=1cm, text centered, font=\normalsize, color=0b71a967-1f15-55a5-9bb9-70efa7b4fc58, draw=f3551e38-74df-57e2-b793-83d7fe876c85, line width=1, fill=747aec21-333b-59ee-84e3-ddff893e5ccd}}

\begin{tikzpicture}[node distance=.3cm]
  \node (zb) [69bbb168-da59-5865-902f-94e77902bf95,fill=yellow] {First-order concepts};
  \node (zc) [69bbb168-da59-5865-902f-94e77902bf95, right=4cm of zb,  text width=3cm,fill=yellow] {Second-order themes};
  \node (zd) [69bbb168-da59-5865-902f-94e77902bf95,, right=4cm of zc,text width=2cm,fill=yellow] {Aggregate dimensions};
  \node (a) [69bbb168-da59-5865-902f-94e77902bf95, below=of zb] {Creation of resources (apps, APIs, SDKs, mini-apps)};
  \node (b) [69bbb168-da59-5865-902f-94e77902bf95, below=of a] {Transforming structure of organizing business (from app on SIM to app on smartphone)};
  \node (c) [69bbb168-da59-5865-902f-94e77902bf95, below=of b] {Onboarding users and complementors on the app};
  \node (d) [69bbb168-da59-5865-902f-94e77902bf95, right=4cm of b,  text width=3cm] {Platform-based organizing};
  \node (f) [69bbb168-da59-5865-902f-94e77902bf95, below=of c] {Cell teams are created based on projects};
  \node (g) [69bbb168-da59-5865-902f-94e77902bf95, below=of f] {Decentralisation of decision making};
  \node (h) [69bbb168-da59-5865-902f-94e77902bf95, right=4cm of $(f.east)!1/2!(g.east)$, text width=3cm] {Adapting organization structure};
  \node (e) [69bbb168-da59-5865-902f-94e77902bf95, right=4cm of $(d.east)!1/2!(h.east)$,  text width=2cm] {Organizing};
  \draw [arrow] (a) -- (d);
  \draw [arrow] (b) -- (d);
  \draw [arrow] (c) -- (d);
  \draw [arrow] (d) -- (e);
  \draw [arrow] (f) -- (h);
  \draw [arrow] (g) -- (h);
  \draw [arrow] (h) -- (e);
\end{tikzpicture}

\end{document} 

请注意,输出看起来不错,但由于 Okular/KDE 错误,以下图像看起来很糟糕。我对质量真的很抱歉。

使用 calc 对齐节点

请注意,机器生成的代码往往会包含不必要的内容。例如,颜色(0,0,0)就是。black

相关内容