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?

enter image description here

  • 1
    Look at the groupplots library, or set at={<coordinate>} for the second axis. May 24, 2016 at 9:03

1 Answer 1


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

An example with the \texttt{groupplots} library:

  group style={
    group size=2 by 1,
    y descriptions at=edge left,
    horizontal sep=2mm
  scale only axis,



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

\begin{axis}[name=Ax1,ymax=0.99] %ymax just for example

\begin{axis}[name=Ax2,at={($(Ax1.north east)+(1cm,0)$)},anchor=north west]

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.