# [Tex/LaTex] How to draw density estimate on histogram by pgfplots

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}


You can use gnuplot to do the kernel density estimate:

\documentclass{article}
\usepackage{pgfplots}

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