# Asymmetric “enlarge x limits” in pgfplots

I need to specify different "enlarge x limits" for the lower and upper axis extrema. Something like enlarge x limits={{value=0.2,upper}, {value=0.4,lower}} does not work however. Any ideas? Using xmin and xmax to modify the range first is not an option as I use "symbolic x coords".

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar,ymin=0,symbolic x coords={a,b,c}, enlarge x limits=true, xtick=data, legend pos=south east]
\addplot coordinates { (a,10) (b,15) (c,20) };
\end{axis}
\end{tikzpicture}
\end{document}


Here I want to make room at lower side to show the bar properly and add more whitespace at the upper side to make room for the legend (I prefer to keep the legend inside the plot).

-
Welcome to TeX.SE. It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. I also helps to test that the solution indeed does work. –  Peter Grill Oct 4 '11 at 15:05

PGFPlots uses the same value for both upper and lower limit in enlarge * limits; the use-case of different values is unsupported (sorry). You may need to consider a different solution.

-

Without a MWE I am not sure I fully understand the problem. But, it appears that using xmax to specify the upper limit even with symbolic x coords seems to work fine. Here I specified xmax=i, and did not specify xmin:

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[xmax=i,symbolic x coords={a,b,c,d,e,f,g,h,i}]
\addplot+[smooth] coordinates { (a,42) (b,50) (c,80) (f,60) (g,62) (i,90)};
\end{axis}
\end{tikzpicture}
\end{document}


If I have misunderstood your question, please provide a specific compilable example.

-
The example is representative enough, but the problem is that you cannot extend the whitespace using xmax, only limit it to the last datapoint. I need to extend the whitespace both at the upper and lower end, but in different proportions. –  Johan Oct 5 '11 at 9:22