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 a grid in the background and more values on the y-axis.

Can you help me out?

\begin{tikzpicture}
\begin{axis}[width=14cm,height=6cm,title={Entwicklung},ylabel={Wachstum in Prozent},
    symbolic x coords={a,b,c,d,e},
    xtick=data]
    \addplot[ybar,fill=blue] coordinates {
        (a,61.5)
        (b,-9.8)
        (c,-27.6)      
        (d,-14.7)      
        (e,3.2)                
    };
\end{axis}
\end{tikzpicture}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Some more specifications to the axis environment should do the trick.

\documentclass{minimal}
\usepackage{pgfplots}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[%
      grid=major,
      width=14cm,height=8cm,
      title={Entwicklung},ylabel={Wachstum in Prozent},
      symbolic x coords={a,b,c,d,e},
      ymin=-30,ymax=70,
      xtick=data,
      ytick={-30,-20,...,70}
    ]
      \addplot[ybar,fill=blue] coordinates {
        (a,61.5)
        (b,-9.8)
        (c,-27.6)      
        (d,-14.7)      
        (e,3.2)                
      };
    \end{axis}
  \end{tikzpicture}
\end{document}
share|improve this answer
    
Wow thx @donig, fast, correct working answer. The last thing is i need to show up the zero-line, (with or whitout) grid. –  user3369 Feb 5 '11 at 19:44
    
Just modify the interval for the ticks on the y axis (see edits above). I also increased the height of the plot a little bit in order not to have overlapping tick labels. –  Thorsten Donig Feb 5 '11 at 19:52
add comment

Your Answer

 
discard

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