# Combine multiple coordinate systems in one tikz/pgfplot

I need two or three distinct coordinate systems in "one tikz environment". The systems are very similar (some linear functions, some labels, the same axis scale). A horizontal shift or minipage are not sufficient, because I also need to add some cross-connections between these graphs (which it pretty economic). Those "things betweens the graphs" are often just lines (see picture).

Here is some code which at least "looks like" the thing I want to achieve:

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]
\end{axis}
\hspace{8cm}
\begin{axis}[axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]
\end{axis}
\end{tikzpicture}

\end{document}


Just for illustration I manually added a horizontal line to highlight different intercepts of the two lines. This is of cause a very simplistic MWE of what I need to create at the end. Thank you very much.

You can have multiple axes, which can be shifted (don't use \hspace here), and you can define coordinates or nodes within them, which you can connect.

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]
\coordinate (X1) at (0,2);
\end{axis}

\begin{axis}[xshift=8cm,axis lines=middle,xmin=-0.5,xmax=10.5,ymin=-0.5,ymax=33]

• @marmot One more question, I use scaling for the entire picture \begin{tikzpicture}[scale=1.4] this scales everything within my axis-environment, but does not adjust the additional lines, that is to say, it results in a vertical shift of \draw[very thick] (X1) -- (X2);  How can I circumvent this? – Marco Feb 27 at 16:08
• @Marco Yes, if you do too many of the transformations there will always be a situation in which pgfplots does not catch up with them, see also tex.stackexchange.com/a/463789/121799. I am not saying scale=1.4 is too much. pgfplots is being continuously updated, and you are using an older version (but switching to the newer version only does not fix this here). For the moment, you could do \scalebox{1.4}{\begin{tikzpicture} ... \end{tikzpicture}}. – user121799 Feb 27 at 16:20