使用 tikz 包创建图表

使用 tikz 包创建图表

我已经尝试了好久,但还是没能成功设计出这张图。这是我第一次尝试使用这个包。有人能帮我吗?谢谢 :)

这是我目前所拥有的:

\begin{单空格}

\begin{tikzpicture}[
level 1/.style={sibling distance=50mm},
edge from parent/.style={->,draw},
>=latex]

% root of the the initial tree, level 1
\node[root] {VC: Global Showcase Event}
% The first level, as children of the initial tree
child {node[level 2] (c1) {Project Managment}}
child {node[level 2] (c2) {Ambassadors}}
child {node[level 2] (c3) {Marketing}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below of = c1, xshift=15pt] (c11) {Project Assigned};
\node [below of = c11] (c12) {Project Start};
\node [below of = c12] (c13) {Plan Created};

\node [below of = c2, xshift=15pt] (c21) {Using a Matrix};
\node [below of = c21] (c22) {Create Ambassadors Requriements};
\node [below of = c22] (c23) {Contact Possible Ambassadors};
\node [below of = c23] (c24) {Comm Devlopments};

\node [below of = c3, xshift=15pt] (c31) {Default arrows};
\node [below of = c31] (c32) {Set Marketing Objectives};
\node [below of = c32] (c33) {Design Survey};
\node [below of = c33] (c34) {Publish Questionaire};
\node [below of = c34] (c35) {Evlauate Results};
\node [below of = c35] (c36) {Design Communication Plan};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
\draw[->] (c1.195) |- (c1\value.west);

\foreach \value in {1,...,4}
\draw[->] (c2.195) |- (c2\value.west);

\foreach \value in {1,...,5}
\draw[->] (c3.195) |- (c3\value.west);
\end{tikzpicture}


\end{singlespace}

在此处输入图片描述

答案1

它是一棵树,所以自然而然地,我推荐森林......

加载edges库可以访问folder排版目录样式树的样式。虽然这不是您发布的图像所显示的内容,但我认为您试图使用您发布的代码来做到这一点。(尽管我对此完全没有信心。)

森林的优点在于所有节点的定位都是自动完成的,并且在这种情况下,我们还可以根据级别自动为树着色。

省略阴影可减少光彩。

\documentclass[tikz,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\begin{document}
\colorlet{myyellow}{yellow!50}
\begin{forest}
  colour me/.style={top color=#1!75, bottom color=#1, draw=#1, thick, blur shadow, rounded corners},
  for tree={
    edge=-Latex,
    font=\sffamily,
  },
  where level=1{
    for tree={
      folder,
      grow'=0,
    },
    edge path'={(!u.parent anchor) -- ++(0,-15pt) -| (.child anchor)},
  }{},
  before typesetting nodes={
    for tree={
      content/.wrap value={\strut #1},
    },
    if={isodd(n_children("!r"))}{
      for nodewalk/.wrap pgfmath arg={{fake=r,n=#1}{calign with current edge}}{int((n_children("!r")+1)/2)},
    }{},
    tempcounta/.max={level}{tree},
    for tree={
      colour me/.wrap pgfmath arg={cyan!#1!myyellow}{100*((tempcounta)-level())/(tempcounta)}
    }
  }
  [VC: Global Showcase Event
    [Project Management
      [Project Assigned]
      [Project Start]
      [Plan Created]
    ]
    [Ambassadors
      [Using a Matrix]
      [Create Ambassadors Requirements]
      [Contact Possible Ambassadors]
      [Comm Developments]
    ]
    [Marketing
      [Default arrows]
      [Set Marketing Objectives]
      [Design Survey]
      [Publish Questionnaire]
      [Evaluate Results]
      [Design Communication Plan, no edge, colour me=yellow]
    ]
  ]
\end{forest}
\end{document}

森林解决方案

相关内容