gpt4 book ai didi

latex - Tikz:绘制分类法/分类图

转载 作者:行者123 更新时间:2023-12-04 14:27:51 69 4
gpt4 key购买 nike

我是第一次用TikZ,不知道这个分类图怎么画。

enter image description here

我只绘制了 2 列,代码如下:

\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}

最佳答案

您可以使用 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}

enter image description here

关于latex - Tikz:绘制分类法/分类图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41789045/

69 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com