I need to draw some nodes for a diagram, but I'm failing to produce a simple horizontally enlarged hexagon.
If I use regular polygon
(from shapes.geometric), I cannot enlarge it (first figure in image below). I tried to set shape aspect
just to no avail.
A workaround I found in the pgfmanual, is to use the chamfered rectangle
(from shapes.misc), but then we must be cautious about the balance between xsep
and how much text there is inside the rectangle (second and third figure in image below).
This is the code that produces the figures below:
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.misc}
\begin{tikzpicture}[node distance=1.5cm]
\node[regular polygon, regular polygon sides=6, shape aspect=0.5, minimum width=4cm, minimum height=1cm, draw] (reg) {Regular node};
\node[chamfered rectangle, chamfered rectangle xsep=2cm, draw] (chamf) [right=of reg] {Enlarged node};
\node[chamfered rectangle, chamfered rectangle xsep=1cm, text width=2cm, draw] (chamfB) [below=of chamf] {Enlarged node with many lines that flow down};
\end{tikzpicture}
Best Answer
To scale the hexagon horizontally, you can use the
xscale
option; you can add the text using thelabel=center:<text>
option to the hexagon node: