How to draw a plot with an axis that resets?

To show the properties of a function with two variables two-dimensionally I want to fix one variable but let it increase between plots that are placed horizontally next to each other, e.g. plot the functions where the fixed variable is set to 0.2, 0.4, 0.6 and 0.8 respectively. One way of doing this is to draw an x axis that is reset after its maximum is reached. Then the plots share y axis. How can one achieve this with pgfplots?

Below is a crude attempt of achieving this. One problem with it is that it is constructed as separate tikzpictures which may be broken over lines (which happens if the latter part of the example is uncommented). Another problem is that the x axis is broken after its reset.

\documentclass{article}

\usepackage{pgfplots}

\pgfplotsset{
foo/.style={
domain=0:1,
xmin=0, xmax=1,
ymin=-1, ymax=1,
axis x line=bottom,
width=5cm,
}
}

\begin{document}

\begin{figure}
\begin{tikzpicture}
\begin{axis}[foo,
axis y line=left
]
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[foo,
hide y axis
]
\end{axis}
\end{tikzpicture}
% \begin{tikzpicture}
%   \begin{axis}[foo,
%     hide y axis
%     ]
%   \end{axis}
% \end{tikzpicture}
% \begin{tikzpicture}
%   \begin{axis}[foo,
%     hide y axis
%     ]
%   \end{axis}
% \end{tikzpicture}
\end{figure}

\end{document}

-

You can have it all in one tikzpicture by using groupplots (or do it explicitly). The groupplots library also enables fine tuning on separation as well.

\usepgfplotslibrary{groupplots}


and then do:

\begin{figure}
\begin{tikzpicture}
\begin{groupplot}[group style={group size=3 by 1,horizontal sep=.3cm}]
\nextgroupplot[foo,axis y line=left]
\nextgroupplot[foo,hide y axis]
\nextgroupplot[foo, hide y axis]
\end{groupplot}
\end{tikzpicture}
\end{figure}


The group size sets how many plots you need next to each other (here a 3x1 grid of plots).

Generally, you do not need a new tikzpicture for each axis environment. You can simply shift the axis placement in the picture.
This is what groupplots automatically does.

You can not end an axis prematurely. That is, you cannot acquire the end arrows and other styling specifics of the axis without ending it.

However, you can change the ticks and thus change the tick labels to restart after some x max. However, that might be more cumbersome than just using groupplots.

The end result of the above is:

-

If you went

\begin{figure}
\mbox{\begin{tikzpicture}...
\end{tikzpicture}}
\end{figure}


There would be no break points (just a single word space) between the plots.

-