# How to align plot axis with different tick label widths?

I want to set tick labels of positive numbers to occupy the same space as negative numbers for alignment of 'ylabel'. I want to avoid absolute setting of location since I have other concerns not to do that. I would like to align the axis, is there any way to set a 'y tick label' to occupy same space with the case when there is a negative sign there. Can I add a hidden negative tick label ?

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgf,pgfplots}
\pgfplotsset{
plot coordinates/math parser=false,
every axis/.append style={
xlabel shift=0.5em,
ylabel shift=-0.5em
}}
\begin{document}

\begin{tikzpicture}
\begin{axis}[%
xlabel={XLABEL},
ylabel={YLABEL},
axis lines*=left]
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[%
xlabel={XLABEL},
ylabel={YLABEL},
ymin=0, ymax=6,
axis lines*=left]
\end{axis}
\end{tikzpicture}

\end{document}


Edit:

I use tikzscale to scale the plots:

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgf,pgfplots,graphicx,subfig}
\usepackage{tikzscale}
\pgfplotsset{
plot coordinates/math parser=false,
every axis/.append style={
xlabel shift=0.5em,
ylabel shift=-0.5em
}}
\begin{document}

\begin{figure}
\subfloat{\includegraphics[width=3cm,height=4cm]{plot1}}
\subfloat{\includegraphics[width=3cm,height=4cm]{plot1}}
\\
\subfloat{\includegraphics[width=3cm,height=4cm]{plot2}}
\subfloat{\includegraphics[width=3cm,height=4cm]{plot2}}
\end{figure}

\end{document}


Results in this output, where the axis are not aligned because of the negative signs of the upper plots

After adding trim axis left and scale only axis it looks like this:

   \pgfplotsset{
plot coordinates/math parser=false,
trim axis left,
scale only axis,
every axis/.append style={
xlabel shift=0.5em,
ylabel shift=-0.5em
}}


-

The "cleanest" way to do this is to set trim axis left so the tick labels aren't taken into account for determining the bounding box, and scale only axis, which specifies that only the axis area without the labels is taken into account for setting the size of the plots. That way, your axis lines will have the same length, and they'll be alined along the y axis:

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgf,pgfplots}
\pgfplotsset{
scale only axis,
width=8cm, height=6cm,
trim axis left,
plot coordinates/math parser=false,
every axis/.append style={
xlabel shift=0.5em,
ylabel shift=-0.5em
}}
\begin{document}

\begin{tikzpicture}
\begin{axis}[%
xlabel={XLABEL},
ylabel={YLABEL},
axis lines*=left]
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[%
xlabel={XLABEL},
ylabel={YLABEL},
ymin=0, ymax=6,
axis lines*=left]

Thank you Jake for the useful answer. Now the problem I have is that, I am using the tikzscale package to scale the plots and setting trim axis left or scale only axis lead to an inappropriate scaling with that package. Do you know of any other ways to align the axis which doesn't require these two settings? (compatible with tikzscale scaling) –  M.Reza Jan 28 '13 at 7:51
There are other options, but it would be good if you could edit your question to include an example closer to the setup you're actually using (i.e. including tikzscale, and the alignment options you're using). –  Jake Jan 28 '13 at 8:17
@ Jake, I edited the post and included a sample with tikzscale` package. Would appreciate any help on that. –  M.Reza Jan 28 '13 at 16:46