# Usings tikz, how can I specify a coordinate with the x value from the coordinate in one system and the y value from the coordinate in another system?

Usually, I would use (a, b |- c, d) to get the coordinate (a, d). But what do I do when (a, b) and (c, d) are in different coordinate systems? In particular, my first coordinate is (axis cs:a, b) (from pgfplots) and the second coordinate is simply (c, d). In addition, I'm using symbolic x coordinates, so a is specified as {foobar}.

\documentclass{article}
\usepackage{fullpage}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[symbolic x coords={{foo}, {bar}}]

({foo}, 0)
({bar}, 0)
};

% Works fine:
\draw [->, green] (axis cs:{foo}, 0.1) -- (axis cs:{bar}, 0.1);

% Package PGF Math Error: Could not parse input ' 0 |- 0' as a floating point
%  number, sorry. The unreadable part was near '|- 0'..
\draw [->, red] (axis cs:{foo}, 0 |- 0, -0.1) -- (axis cs:{bar}, 0 |- 0, -0.1);

\end{axis}
\end{tikzpicture}
\end{document}

-

Use braces to group the coordinates:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[symbolic x coords={{foo}, {bar}}]

({foo}, 0)
({bar}, 0)
};

% Works fine:
\draw [->, green] (axis cs:{foo}, 0.1) -- (axis cs:{bar}, 0.1);

\draw [->, red] ({axis cs:{foo}, 0} |- 0, -0.1) -- ({axis cs:{bar}, 0} |- 0, -0.1);

\end{axis}
\end{tikzpicture}
\end{document}

-