[Tex/LaTex] pgfplot – remove “top-border-line” and spacing between x-axis and bars

pgfplots

I am currently trying to create a bar chart using pgfplots.

My objective is to create a bar chart in which the bars are directly "sitting on top" of the x-axis AND there should be no "top-border-line" that limits my figure.

Currently, my code looks like this:

\documentclass{scrbook}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
     width  = 12cm,
     hide y axis,
     height = 8cm,
     bar width=20pt,
     symbolic x coords={2010, 2011, 2012, 2013, 2014, 2015},
     nodes near coords,
     ]
     \addplot[ybar, fill=black] coordinates {
          (2010,1)
          (2011,3)
          (2012,11)
          (2013,15)
          (2014,29)
          (2015,14)
     };
\end{axis}
\end{tikzpicture}
\end{document} 

Thank you very much for your support! 🙂

Best Answer

Add

     axis x line*=bottom,
     ymin=0

to the axis options:

\documentclass{scrbook}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
     width  = 12cm,
     hide y axis,
     axis x line*=bottom,
     height = 8cm,
     bar width=20pt,
     symbolic x coords={2010, 2011, 2012, 2013, 2014, 2015},
     nodes near coords,
     ymin=0
     ]
     \addplot[ybar, fill=black] coordinates {
          (2010,1)
          (2011,3)
          (2012,11)
          (2013,15)
          (2014,29)
          (2015,14)
     };
\end{axis}
\end{tikzpicture}
\end{document} 

enter image description here