Latex Tikz:绘制分类/分类图

Latex Tikz:绘制分类/分类图,latex,tikz,Latex,Tikz,我第一次使用TikZ,我不知道如何绘制这个分类图 我只画了两列,代码如下: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes,snakes,positioning,shapes.misc} \begin{document} \begin{tikzpicture} \node at (-3,1) [rectangle, aspect=0.5, draw=black!60,fill=black!20, inn

我第一次使用TikZ,我不知道如何绘制这个分类图

我只画了两列,代码如下:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,snakes,positioning,shapes.misc}

\begin{document} 
\begin{tikzpicture}
  \node at (-3,1) [rectangle, aspect=0.5, draw=black!60,fill=black!20, inner sep=3pt, text width=2cm,,align=center](a){text text text};
  \node at (-9,-1) [rectangle,draw](b1){text2};
  \node at (-8.7,-2) [rectangle,draw](b2){text3};
  \node at (-8.7,-3) [rectangle,draw](b3){text4};
  \node at (-8.7,-4) [rectangle,draw](b4){text5};
  \node at (-8.7,-5) [rectangle,draw](b5){text6};

  \draw[->,thick] (a)--(0,0)--(-9,0);
  \draw[->,thick] (-9,0)--(b1);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]b1.210)|-([]b2.west);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]b1.210)|-([]b3.west);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]b1.210)|-([]b3.west);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]b1.210)|-([]b4.west);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]b1.210)|-([]b5.west);

  %%%%%%%%%%%%%%%%%%%%%%%
  \node at (5,-1) [rectangle,draw](c1){text2};
  \node at (4.7,-2) [rectangle,draw](c2){text3};
  \node at (4.7,-3) [rectangle,draw](c3){text4};
  \draw[->,thick] (a)--(0,0)--(5,0);
  \draw[->,thick] (5,0)--(c1);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]c1.330)|-([]c2.east);
  \draw[->,thick] ([xshift=0cm,yshift=0cm]c1.330)|-([]c3.east);
\end{tikzpicture}
\end{document}
您可以使用林包,而不是尝试使用tikz手动绘制它。然后,更容易更改实际内容(节点、列数等):

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{arrows.meta}
\usepackage{forest}

\begin{document}
    \begin{forest}
      for tree={
        line width=0.5pt,
        draw=black,
        fit=rectangle,
        edge={color=black,>={Triangle[]}, ->},
        if level=0{%
          l sep+=1cm,
          for descendants={%
            calign=first,
          },
          align=center,
          parent anchor=south,
        }{%
          if level=1{%
            parent anchor=south west,
            child anchor=north,
            tier=three ways,
            align=center,
            for descendants={%
              child anchor=west,
              parent anchor=west,
              align=left,
              anchor=west,
              xshift=-20pt,
              edge path={
                \noexpand\path[\forestoption{edge}]
                (!to tier=three ways.parent anchor) |-
                (.child anchor)\forestoption{edge label};
              },
            },
          }{}%
        },
      }
      [Drawing Diagrams
        [Operational
          [Offloading\\method
            [Cost\\benefit\\analysis
              [Mobility\\management
                [Connection\\protocol]
              ]
            ]
          ]
        ]
        [End user
          [Incentives
            [Presentation\\and usability]
          ]
        ]
        [Service level
          [Performance
            [Cloud APIs]
          ]
        ]
      ]
    \end{forest}
\end{document}