I've a .csv with a column of acquired measures. I would like to make the histogram bins using TeX from the measures distribution so I have to create the bins first. I haven't found any reference to perform an automatic binning or to set manually the intervals to produce the bins. I would like to know how can I do that and if I can perform non-uniform bins histogram.
\documentclass[border=5mm]{standalone}
\usepackage{filecontents}
\usepackage{pgfplots, pgfplotstable}
\begin{filecontents}{data.csv}
dist
1
2
2.5
2
1
3.5
3
1
3
2
1
1
0.5
1
1.5
1
\end{filecontents}
\begin{document}
\begin{tikzpicture} \begin{axis}
\addplot[xbar] table [
col sep=comma,
x=dist
] {data.csv};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}
\addplot [ybar interval] table [
col sep=comma,
y=dist
] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
I perform this usually in python (code below) this should be the output:

import matplotlib.pyplot as plt
dist=[1, 2, 2.5, 2, 1, 3.5, 3, 1, 3, 2, 1, 1, 0.5, 1, 1.5, 1]
plt.hist(dist,7) #Compute the histogram of a set of data.




filecontentsapproach used in my answer is just to make copying and pasting the example easier. – Jake Feb 24 '15 at 12:34