[Tex/LaTex] Using names for coordinates in TIKZ

nodestikz-pgf

I want to create some figures in tikz with a lot of lines between some points and therefore I define them as coordinates first. Now I want to name the horizontal lines on the left side by using the variable name of the left point, but all the names are at the same spot. How can I correct this behaviour?

enter image description here

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}

\coordinate (a) at (0,0);
\coordinate (b) at (10,0);

\coordinate (c) at (0,2);
\coordinate (d) at (10,2);

\coordinate (e) at (0,4);
\coordinate (f) at (10,4);

\draw[|-|] (a) -- (b);
\draw[|-|] (c) -- (d);
\draw[|-|] (e) -- (f);

\node[left=5mm of a]  {Random length};
\node[left=5mm of c]  {Original series};
\node[left=5mm of e]  {Bootstrap sample};
\end{tikzpicture}

\end{center}
\end{figure}

\end{document}

Best Answer

TikZ library positioning is needed for the syntax left=5mm of a:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{figure}
\begin{center}
\begin{tikzpicture}

\coordinate (a) at (0,0);
\coordinate (b) at (10,0);

\coordinate (c) at (0,2);
\coordinate (d) at (10,2);

\coordinate (e) at (0,4);
\coordinate (f) at (10,4);

\draw[|-|] (a) -- (b);
\draw[|-|] (c) -- (d);
\draw[|-|] (e) -- (f);

\node[left=5mm of a]  {Random length};
\node[left=5mm of c]  {Original series};
\node[left=5mm of e]  {Bootstrap sample};
\end{tikzpicture}

\end{center}
\end{figure}

\end{document}

Result

Without library positioning, there are error messages like:

! Package PGF Math Error: Unknown operator `o' or `of' (in '5mm of a').