I try to create a stacked histogram. Like this:

My data consists of classes (0-4) and a float value for each class.
I already have a histogram for all mean values. But I would like to color the bars according to the amount of classes in each bar.
What I have:

Code:
\documentclass{article}
\usepackage{filecontents}
\usepackage{pgfplots, pgfplotstable}
% first number is a class (0-4), second float number is the mean of the data
\begin{filecontents*}{data.csv}
1,0.177597344546
1,0.18105947348
1,0.177429493018
2,0.244377481246
4,0.185496836789
0,0.180714004683
4,0.187928321127
3,0.188037364067
4,0.187302774169
3,0.188172520266
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ybar stacked,
ymin=0,
]
\addplot +[
hist={
bins=20,
}
] table [x, y, col sep=comma] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
