[Tex/LaTex] Generate regular polygon

tikz-pgf

I want to generate a regular polygon with 6 sides in TikZ. But I can not
compile the following:

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

Best Answer

You need to use the shapes.geometric library in order to use the regular polygon shape. After that your code should work just fine.

Related Question