如何绘制像该图一样的图表?

如何绘制像该图一样的图表?

这样的图叫分类图吗?LaTeX 中是否有任何包可以帮助直接绘制它,就像父子图一样?

在此处输入图片描述

答案1

\documentclass{standalone}
\usepackage{tikz}
  \usetikzlibrary{shapes,arrows,fit,calc,positioning}
  \tikzset{box/.style={draw, rectangle, thick, text centered, minimum height=3em}}
  \tikzset{line/.style={draw, thick, -latex'}}
\begin{document}
    \begin{tikzpicture}[auto]
        \node [box]                                    (inv)      {Inventory};
        \node [box, below=0.5cm of inv]                (deter)    {Deterioration};
        \node [box, right=0.5cm of deter]              (noobs)    {No Obsolescence/Deterioration};
        \node [box, left=0.5cm of deter]               (obs)      {Obsolescence};
        \node [box, below=1.5cm of deter, xshift=-2cm] (decay)    {Decaying products};
        \node [box, below=1.5cm of deter, xshift=2cm]  (per)      {Perishable Products};
        \node [box, below=1.5cm of per, xshift=2cm]    (fix)      {Fixed Lifetime};
        \node [box, below=1.5cm of per, xshift=-2cm]   (cont)     {Continuously Deteriorating};

        \path [line] (inv)   --    (deter);
        \path [line] (inv)   -|    (noobs);
        \path [line] (inv)   -|    (obs);
        \path [line] (deter) --    (per);
        \path [line] (deter) --    (decay);
        \path [line] (per)   --    (cont);
        \path [line] (per)   --    (fix);

    \end{tikzpicture}
\end{document}

在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz}
  \usetikzlibrary{shapes,arrows,fit,calc,positioning}
  \tikzset{box/.style={draw, rectangle, thick, text centered, minimum height=3em}}
  \tikzset{line/.style={draw, thick, -latex'}}
\begin{document}
    \begin{tikzpicture}[auto]
        \node [box]                                     (inv)      {Inventory};
        \node [box, below=0.5cm of inv]                 (deter)    {Deterioration};
        \node [box, right=0.5cm of deter]               (noobs)    {No Obsolescence/Deterioration};
        \node [below=0.5cm of deter]                    (vuoto1)   {};
        \node [box, left=0.5cm of deter]                (obs)      {Obsolescence};
        \node [box, below=0.5cm of vuoto1, xshift=-2cm] (decay)    {Decaying products};
        \node [box, below=0.5cm of vuoto1, xshift=2cm]  (per)      {Perishable Products};
        \node [below=0.5cm of per]                      (vuoto2)   {};
        \node [box, below=0.5cm of vuoto2, xshift=2cm]  (fix)      {Fixed Lifetime};
        \node [box, below=0.5cm of vuoto2, xshift=-2cm] (cont)     {Continuously Deteriorating};

        \path [line] (inv)      --    (deter);
        \path [line] (inv)      -|    (noobs);
        \path [line] (inv)      -|    (obs);
        \path [line] (deter)    --    (vuoto1);
        \path [line] (vuoto1)   -|    (decay);
        \path [line] (vuoto1)   -|    (per);
        \path [line] (per)      --    (vuoto2);
        \path [line] (vuoto2)   -|    (cont);
        \path [line] (vuoto2)   -|    (fix);

    \end{tikzpicture}
\end{document}

在此处输入图片描述

编辑:替代

\node [below=0.5cm of deter]                    (vuoto1)   {};

\node [below=0.5cm of per]                      (vuoto2)   {};

\coordinate [below=0.5cm of deter]                    (vuoto1)   {};

\coordinate [below=0.5cm of per]                      (vuoto2)   {};

产量

在此处输入图片描述

答案2

这是使用该包的起点forest。这实际上是一个用于语言树的包,但可用于多种用途。

\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
  for tree={edge=->}
  [Inventory
    [Obsolecence]
    [Deterioration
      [Decaying products]
      [Perishable Products
        [Continuously Deteriorating]
        [Fixed Lifetime]
      ]
    ]
    [No Obsolenscence/Deterioration]
  ]
\end{forest}
\end{document}

在此处输入图片描述

与 TikZ 库相同graphdrawing。需要luatex

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}
  \graph[tree layout] {
  "Inventory" ->
    {
      "Obsolecence",
      "Deterioration" ->
      {
        "Decaying products",
        {
          "Perishable Products" ->
          {
            "Continuously Deteriorating",
            "Fixed Lifetime"
          },
        }
      },
      "No Obsolenscence/Deterioration"
    }
  };
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容