我想生成一个有 6 条边的正多边形TikZ
。但是我无法编译以下内容:
\begin{figure}
\resizebox{8 cm}{8 cm}{
\begin{tikzpicture}[scale=2]
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,2) {center \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,3.74) {adjacent \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (2,0.26) {adjacent \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (0.5,2.87) {adjacent \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (0.5,1.13) {adjacent \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (3.5,2.87) {adjacent \ node};
\node [draw, thick, minimum size=3cm, regular polygon, regular polygon sides=6] at (3.5,1.13) {adjacent \ node};
\end{tikzpicture}
}
\caption{Nodes placed in hexagonal grid when ROI partitioned in to regular hexagons}
\end{figure}
答案1
您需要使用该shapes.geometric
库才能使用该regular polygon
形状。之后您的代码应该可以正常工作。