# Disable the stretching effect of axes in tikz for data smaller than ymax or xmax

Consider the example below:

\documentclass{article}
\usepackage{tikz,pgfplots}
\usepackage{animate}
\pgfmathdeclarefunction{normal}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
\begin{document}
\begin{figure}[ht]
\begin{center}
\begin{animateinline}[controls,palindrome]{5}
\multiframe{15}{ik=1+1}{
\begin{tikzpicture}
\begin{axis}[
hide y axis,
axis lines*=center,
axis on top,
no markers,
domain=0:25,
samples=100,
xlabel=\empty,
ylabel=\empty,
every axis x label/.style={at=(current axis.right of origin),anchor=west},
every axis y label/.style={at=(current axis.above origin),anchor=south},
xmin = 0, xmax = 25,
ymin = 0, ymax = 1,
xtick=, ytick=data,
enlargelimits=false,
clip=false
]
\end{axis}
\end{tikzpicture}
}
\end{animateinline}
\end{center}
\end{figure}
\end{document}


As you can see, during the animation the axis stretches. I want to fix the axis (and the graph) to use a set coordinate system without deviating from it. So it will show e.g. the scope of x=[0,4] and y=[0,4], regardless of the intervals of the curve (in this case the curve has a variable height in the y-direction, causing the axis to stretch to compensate). Alternatively, a key, for instance fix axes to set coordinate system or something, is what I'm looking for.

-
This happens because you're hiding the y axis. You can correct the bounding box by adding a dummy node using \node (dummy) at (rel axis cs:0,1) {}; just before \end{axis}. –  Jake Jun 4 '14 at 9:54
@Jake Worked perfectly. :-) You can post it as an answer if you wish? –  1010011010 Jun 4 '14 at 10:20

This happens because you're hiding the y axis. You can correct the bounding box by adding a dummy node using \node (dummy) at (rel axis cs:0,1) {}; just before \end{axis}.