How to draw density estimate on histogram by pgfplots?

I know how to draw a density histogram using pgfplots from this answer: Is it possible to "transform" a histogram into a density plot in pgfplots?.

But how can I draw an estimate line on the histogram like this?

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{
small,
every axis plot post/.style={
fill=orange!75,
draw=orange!50!black
},
trim axis left
}

\begin{tikzpicture}
\begin{axis}[ymin=0, title=\texttt{hist=density}]
\addplot [hist=density] table [y index=0] {random.txt};
\end{axis}
\end{tikzpicture}
\end{document}

• Could you post an MWE of what you have tried so far (at least something people can work with and expand)? Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. – moewe Feb 17 '14 at 7:38
• The smooth histogram depends on a certain Kernel and a bandwidth. I would suggest to use an external programm for the calculation and import the data. Using knitr (and R) or a shell command from within latex could be helpful. – jens_bo Feb 17 '14 at 10:12

You can use gnuplot to do the kernel density estimate:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ymin=0]