# Plotting chi square distribution [closed]

How to plot the picture above?

• plotting a chi-square distribution
• shading an area of distribution
• annotating the figure
• what you try so far? now it seems as "do-it-instead-me", which likely will not be answered. do you have table for chi.square function? Jan 6 '18 at 17:05
• This might get closed (though there are plenty of questions like this that do get answers), but you can look at tex.stackexchange.com/a/40916 for a way of plotting a chi-squared distribution, and you can look at the fillbetween library of pgfplots to do the filled part on the right. Jan 6 '18 at 18:42
• For the record: This is a second attempt to ask "the same" question. The first attempt is tex.stackexchange.com/q/409088/95441. Jan 6 '18 at 18:52

\documentclass[pstricks]{standalone}
\usepackage{pst-func}

\begin{document}

\psset{xunit=1.2cm,yunit=15cm,plotpoints=200}
\begin{pspicture*}(-0.75,-0.1)(10,0.35)
\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
\psline(6,0)(6,0.06)
\psChiIIDist[linewidth=1pt,linecolor=red,nue=3.5]{6}{9}
\psline(9,0)
}
\psline(6,-0.01)(6,0.2)
\psChiIIDist[linewidth=1.5pt,linecolor=red,nue=3.5]{0.01}{9}
\psaxes[Dy=0.1,labels=none,ticks=none]{->}(0,0)(9.5,0.3)
\pcline[nodesepB=5pt]{<-}(0,0.15)(6,0.15)\ncput*{\footnotesize Not Refecting of $H_0$}
\pcline[nodesepA=5pt]{->}(6,0.15)(9.5,0.15)%
\ncput*{\footnotesize\shortstack{Refecting\\Region of\\$H_0$}}
\rput(6,-0.025){\footnotesize Critical $\chi^2=2.547$}
\rput(8,-0.05){\footnotesize Calculated $\chi^2=5.147$}
\psline{->}(8,-0.03)(8,0)
\psframe*[linecolor=black,opacity=0.1](-0.75,-0.1)(10,0.35)
\end{pspicture*}

\end{document}