I want to create 6 hexagons side by side, each having a different number of edges dashed instead of normal. How is it possible?
The code I currently use to create a single hexagon is:

    \foreach \n in {1,2,...,6} {
    \node at (\n*2.5-4,1)[above left] {\n$.$} ;
    \draw [xshift=\n*2.5cm-3cm] (0:1cm) \foreach \x in {1,2,...,6} {
        -- (\x*60:1cm)} --cycle (90:1cm);

I don't mind creating each hexagon individually if there's no simple way to create them in a loop, but I don't even know how to do that.

edit: Clarifications: What I want to achieve is basically a list of hexagons, each with a different "order" of edges dashed (That is, all the possible variations of dashed edges such that you can't get from one to the other by rotating the hexagon). I though that's a bit too broad of a questiong so I asked about the coloring of one hexagon with a certain dashed pattern, but I guess I wasn't clear enough (sorry for that, English is not my mother tounge so stuff tend to get messy).

I'm using TeX through Lyx and don't really know how to use it very well, so I don't know how to post an MWE, sorry :(.

  • 1
    I think you should post a full MWE, not just a snippet. It is hard to understand what you really want: what exactly is 'side by side' (i.e. do they have common side or are they entirely separate hexagons)? what do you mean by 'a different number of edges dashed'? is there a pattern to follow? etc.
    – Count Zero
    Nov 17, 2012 at 18:14

2 Answers 2


If you really want to meet the constraint

all the possible variations of dashed edges such that you can't get from one to the other by rotating the hexagon

then an alternate solution is required.

The number of dashed edges is increased for each row, and the ones that are equivalent by rotational symmetry have an opacity applied to them:

enter image description here



\tikzset{Dashed/.style={dashed, red}}
\tikzset{Duplicate/.style={opacity=0.5, thin, gray}}
  %\node at (#1*2.5-4,1)[above left] {$#1.$};
  \begin{scope}[xshift=#2*2.5cm-3cm,#1] %,rotate=#1*60
    \draw[solid, #3] (   0:1cm) -- (1*60:1cm);
    \draw[solid, #4] (1*60:1cm) -- (2*60:1cm);
    \draw[solid, #5] (2*60:1cm) -- (3*60:1cm);
    \draw[solid, #6] (3*60:1cm) -- (4*60:1cm);
    \draw[solid, #7] (4*60:1cm) -- (5*60:1cm);
    \draw[solid, #8] (5*60:1cm) -- (6*60:1cm);
\begin{tikzpicture}[ultra thick, blue]
  \Hexagon           {1}{Dashed}{}{}{}{}{}
  \Hexagon           {1}{Dashed}{Dashed}{}{}{}{}
  \Hexagon           {2}{Dashed}{}{Dashed}{}{}{}
  \Hexagon           {3}{Dashed}{}{}{Dashed}{}{}
  \Hexagon           {1}{Dashed}{Dashed}{Dashed}{}{}{}
  \Hexagon           {2}{Dashed}{Dashed}{}{Dashed}{}{}
  \Hexagon           {3}{Dashed}{Dashed}{}{}{Dashed}{}
  \Hexagon           {1}{Dashed}{Dashed}{Dashed}{Dashed}{Dashed}{}
  • Yeah, I knew this part, that's why I only asked for a quick tikz advice in order to do it on my own. I'm already done with it. But I didn't even know the idea of creating a hexagon command like that is even possible, would definitely have saved me some work. (though not much thanks to copy paste, but would made the file A LOT neater and more readable).
    – Nescio
    Nov 17, 2012 at 22:48
  • Wow, this is actually quite amazing now! I have a feeling I'm really going to enjoy tikz
    – Nescio
    Nov 17, 2012 at 22:56

answering your question would at least be easier if you provided us with a picture of some sort of what you want to achieve.

The following does produce 6 different hexagons:


\foreach \n in {1,2,...,6}  
  \node at (\n*2.5-4,1)[above left] {\n$.$};
    \draw[dashed] (0:1cm) -- (60:1cm);
    \draw (60:1cm) \foreach \x in {2,...,6} {-- (\x*60:1cm)};

Result in:


  • This is exactly the answer I was looking for. The idea (well, at list the first step), is that 1 would have 1 dashed line, 2 would have 2, 3 would have 3 and so on. But that I was able to do myself. btw if I had a picture of what I want I wouldn't need to creat one with tikz...
    – Nescio
    Nov 17, 2012 at 22:24
  • 1
    @Nescio You could have had a sketch that you had made in some other program, e.g. Paint, or by hand on paper and had scanned/photographed. Nov 18, 2012 at 0:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .