[Tex/LaTex] Building a pgfplot bar chart with values above each bar

bar charthistogramtikz-pgf

It is the first time for me trying to build a bar chart. Obviously I am encountering some problems with that. The plot should have some space between bars. And the y-Values should be above each bar. Horizontal lines at each y-Axis values should also be part of the graph, but not the vertical ones. I am also encountering some problems with setting the width, so that the bars are always attached to each other. I would like to build such a plot:enter image description here

Could you please help me?

Best Answer

This can be done with pgfplots, starting point:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
  \definecolor{myblue}{HTML}{1F7ED2}
  \begin{axis}[
    axis x line*=bottom,
    axis y line*=none,
    every outer y axis line/.append style={draw=none},
    every y tick/.append style={draw=none},
    ymin=0,
    ymax=120,
    xticklabel={\pgfmathtruncatemacro\tick{\tick}\tick},   
    ytick={0, 20, ..., 120},
    ymajorgrids,
    y grid style={densely dotted, line cap=round},
    ylabel={Value in billion U.S. dollars},
    nodes near coords,
  ]
    \addplot[
      ybar,
      draw=none,
      fill=myblue,
    ] coordinates {
      (1995, 8.02)
      (1996, 11.29)
      (1997, 15.07)
      (1998, 21.06)
      (1999, 54.91)
      (2000, 105)
      (2001, 40.94)
    };
  \end{axis}
\end{tikzpicture}
\end{document}

Result