如何在六角形的乳胶中创建思维导图?

问题描述 投票:1回答:1

我不愿意在LaTex / TikZ中创建思维导图,而不会将节点显示为方框,圆形或椭圆形。有没有一种方法可以将六边形作为子级来创建思维导图?孩子们应该和角落相连。父母和子女应包含简短文字

我尝试过使用shapes包。

谢谢你,Pjotr​​

latex tikz
1个回答
0
投票

更改子节点的形状很容易,您可以简单地使用形状库中的regular polygon, regular polygon sides=6。但是更改根节点和六边形之间的连接更加困难。

相反,您可以使用普通节点来模拟思维导图:

\documentclass[margin=0.3cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes}


\begin{document}

\begin{tikzpicture}
\def\nchilds{5}
\node[fill=blue!20,circle,minimum size=3cm] at (0,0) (root) {Root};
\foreach \x [count=\xi] in {"test1", "test2", "test3", "test4","test5"}{
    \fill[blue!20, line width=0.2cm] 
        ({(360/\nchilds*\xi)+2}:4cm) to [in=160,out=0,relative] 
        ({(360/\nchilds*\xi)+10}:1.45cm) -- ({(360/\nchilds*\xi)-10}:1.45cm) to [in=180,out=20,relative]  ({(360/\nchilds*\xi)-2}:4cm);
    \node[regular polygon, regular polygon sides=6,fill=blue!20,rotate=(360/\nchilds*\xi),minimum width=2cm] at (360/\nchilds*\xi:4cm) {};
    \node at (360/\nchilds*\xi:4cm) {\x};
}
\end{tikzpicture}


\end{document}

enter image description here

或带有颜色:

\documentclass[margin=0.3cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes}


\begin{document}

\begin{tikzpicture}
\def\nchilds{5}
\node[fill=blue,text=white,circle,minimum size=3cm] at (0,0) (root) {Root};
\foreach \x [count=\xi] in {"test1", "test2", "test3", "test4","test5"}{
    \shade[left color=red,right color=blue, line width=0.2cm,shading angle={(360/\nchilds*\xi)-90}] 
        ({(360/\nchilds*\xi)+2}:3.2cm) to [in=160,out=5,relative] 
        ({(360/\nchilds*\xi)+10}:1.45cm) -- ({(360/\nchilds*\xi)-10}:1.45cm) to [in=175,out=20,relative]  ({(360/\nchilds*\xi)-2}:3.2cm);
    \node[regular polygon, regular polygon sides=6,fill=red,rotate=(360/\nchilds*\xi),minimum width=2cm] at (360/\nchilds*\xi:4cm) {};
    \node[text=white] at (360/\nchilds*\xi:4cm) {\x};
}
\end{tikzpicture}

\end{document}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.