As the title says, I would like to create a histogram from integer values. My MWE is:
\documentclass[border=5]{standalone}
\usepackage{pgfplots}
%Random data between 10 and 20 -- could also be between 100 and 200 or what ever
\begin{filecontents}{data.txt}
18
15
18
19
14
15
12
11
18
18
12
11
17
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=left,
ymajorgrids=true,
title={Histogram},
xlabel=points,
ylabel=headcount,
ybar
]
\addplot+ [hist] table[y index= 0]{data.txt};
\end{axis}
\end{tikzpicture}
\end{document}
The result is:
What i would like to get is (note: unfortunately, I have double-counted the values):
My problems are, the x-axis is not discrete, and that's why the labels are shifted. I would like to have space between the bars - also between y-axis and the first bar and at the end.
Some additional infos: I am using LaTeX. I have already tried to set the precision to 0 and using datatool to first count the frequencies and then draw a simple bar chart. I have struggled with various label and area styles, but couldn't achieve my goal.

](../../images/99614779385083262f2dca2b50649189.webp)

