【问题标题】:Tikz: drawing a taxonomy/classification figureTikz:绘制分类/分类图
【发布时间】:2017-01-22 08:54:05
【问题描述】:

我是第一次使用 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}

【问题讨论】:

    标签: latex tikz


    【解决方案1】:

    您可以使用 forest 包而不是尝试使用 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}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-20
      • 1970-01-01
      • 1970-01-01
      • 2021-09-26
      • 2020-05-08
      • 2011-04-10
      • 1970-01-01
      • 2021-02-02
      相关资源
      最近更新 更多