# Interconnected graphs in pgfplots

Is it possible to create interconnected graphs in pgfplots (e.g. common grids), like the picture below?

And, related to the question above, if you have one tikzpicture environment with two axis environments, is it possible to ensure, that both will have exactly the same measure on both x and y axis?

Edit: I tried to write x axis grid manually, but I had problems using foreach. E.g. example below simply does not work (bunch of endcsname errors).

\documentclass{minimal}
\usepackage{tikz,pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[samples=505,domain=0:630]
\foreach \i in {180,360,540} {\node (a\i) at (axis cs:\i,0) {};}

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

-
– Peter Grill Aug 25 '12 at 21:30

Concerning the first question (grids which pass through a couple of vertically adjacent axes): this will only work if you move the axes so close to each other that the independent grids touch each other (which means that the drawn axis lines will also touch each other). pgfplots has no builtin solution for this feature.
Concerning the second question (ensure the same unit scales): yes, you can explicitly set the amount of space used for each unit (using x=1cm,y=2cm or something like that, compare the manual), and you can explicitly set the displayed ranges (xmin=0,xmax=5).
yes, I would say so. You would probably need some sort of loop to introduce labelled coordinates inside of the first axis and then, after the last axis, you could probably generate TikZ drawing instructions. Interesting aspects might be \pgfkeysvalueof{/pgfplots/ymax} which expands to the maximum y axis limit (but only inside of an axis) and \draw[/pgfplots/every axis grid] which uses the standard grid style of pgfplots. – Christian Feuersänger Aug 25 '12 at 13:10