Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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) };
\addlegendentry{legend}
\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).

share|improve this question
1  
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

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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:

enter image description here

\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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.