I have a bunch of coordinates predefined, where I want to draw multiple lines in a plot by reusing coordinates. If I change a coordinate value, I only want to have to change it once, and not in multiple lists of coordinates. Hence I want to do something like the following
\documentclass[tikz]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\coordinate (p1) at (1,1);
\coordinate (p2) at (2,2);
\addplot coordinates{(p1)(p2)};
\end{axis}
\end{tikzpicture}
\end{document}
To generate something that looks like this
But apparently life can't be that easy, because I get the following error
Runaway argument?
p1)(p2)\pgfplots@EOI \pgfplotsscanlinelengthcleanup
\pgfplots@coord@stream@end
\ETC.
Paragraph ended before \pgfplots@loop@next was complete.
<to be read again>
\par
l.15
I've tried defining the coordinates outside the axis environment as well, but that didn't work either.
Any ideas on how to use predefined coordinates in an \addplot coordinates list?

p1in proper context – percusse Feb 18 '18 at 10:38