\begin{tikzpicture} \foreach[count=\xi] \len in {1,3,2,5,4,2,1} { \draw[|-|] (0, -\xi/2) node [left] {\alphalph{\xi}} -- node [above] {$\len$} (\len, -\xi/2); } \begin{scope}[yshift=-2cm, xshift=7cm] \draw[|-] (0, 0) -- node [below] {a} (1, 0); \draw[|-] (1, 0) -- node [below] {f} (3, 0); \draw[|-|] (3, 0) -- node [below] {b} (6, 0); \end{scope} \end{tikzpicture}