# PGFPlots: Shift the entire axis environment to the right

I would like to plot two separate data files in two separate axis environments so that they are placed right next to each other. They will be part of the same subfigure, so I think I need to shift the content of \begin{axis}...\end{axis} sufficiently to the right.

In materials science, the band structure and density of states are often plotted next to each other, like the one attached. I would like to do this with PGFPlots, but how can I shift the entire axis environment to the right? Do I have to individually move every fragment of the coordinate system, or can I just move everything at once?

• Look at the groupplots library, or set at={<coordinate>} for the second axis. – Torbjørn T. May 24 '16 at 9:03

One option is a groupplot, another is a combination of the name and at keys to position the first axis relative to the second.

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}
An example with the \texttt{groupplots} library:

\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=2 by 1,
y descriptions at=edge left,
horizontal sep=2mm
},
scale only axis,
height=6cm,
ymin=0,ymax=7,
]
\nextgroupplot[width=2cm,xlabel=Something]

\nextgroupplot[width=6cm,xlabel=Else]
\end{groupplot}
\end{tikzpicture}

\bigskip

And by positioning one \texttt{axis} relative to the other.

\begin{tikzpicture}
\pgfplotsset{width=6cm}
\begin{axis}[name=Ax1,ymax=0.99] %ymax just for example
\begin{axis}[name=Ax2,at={($(Ax1.north east)+(1cm,0)$)},anchor=north west]