I want to place a lot of pictures and plots in a long document. By now, I am using figure-environment with center-environment, but the tikz-axis-plots didn't align well with included eps-pictures or tikz-pictures. I read PGFplot to occupy full \linewidth, and aligned y=axis across tikzpicture and the pgfplot-Manual (regarding alignment), and found out, that I can use ylabel style={overlay} and
yticklabel style={overlay}.

To be precise, the situation is better, but images are still not aligned well. I want the left and right border of the grid to be exacly above the other boxes. See my example for illustration.

1 Answer
1

What you are seeing the bounding box of the leftmost x (!) tick label: it shifts your axis to the right.

A possible solution is to use xticklabel style={overlay} as well.

However, my advice is to use

\begin{tikzpicture}[trim axis left, trim axis right]

which configures TikZ to
1. assume a following axis and
2. to skip everything left of that axis and right of that axis when it computes bounding boxes.

This approach is fairly new, and recent versions of pgfplots provide more documentation. The approach will automatically solve this kind of alignment problems (it even works together with image externalization).