# pgfplots and figure centering

I'm wondering about a way to exclude the axis labels and axis graduation from how latex will center the figure with respect to the caption. Labels and graduation along the y-axis (assuming it lies on the left of the figure) will tend to move the rest of the content to the right. I feel like it looks better when only the "main" content serves for centering purposes. Is such feature available?

-
 The straight-forward and manual way would be use negative spacing (via \hspace*{}). But I guess you want something more robust. – Werner Aug 10 '11 at 18:01 Related question: Centering a TikZ picture around an area – Martin Scharrer♦ Aug 10 '11 at 18:21 @Martin: I missed it. If I am correct, it is from May: is there something new? – pluton Aug 10 '11 at 19:41

Using pgf 2.10, you can provide the arguments trim axis left and trim axis right to the tikzpicture environment:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\centering
\begin{tikzpicture}[trim axis left, trim axis right]
\begin{axis}[ylabel={$y$},
xlabel={$x$}]
\end{axis}
\end{tikzpicture}

(a)

\bigskip \bigskip

\begin{tikzpicture} % Example of leaving this out
\begin{axis}[ylabel={$y$},
xlabel={$x$}]