[pstricks] normal and binomial distribution

Doug Mounce mounce at u.washington.edu
Thu Nov 2 20:42:32 CET 2006


Here are a couple you might like.  Someone else gave me a more  
complex version that allows you to draw bins like a histogram, but  
this is a start...

\documentclass[11pt]{article}
\usepackage{pstricks}
\usepackage{pst-func}
\usepackage{pst-plot}
\usepackage{pstricks,pst-plot,pst-math}

\makeatletter
\def\psGaussFill{\pst at object{psGaussFill}}
\def\psGaussFill at i(#1,#2)(#3,#4)#5#6{{
   \pst at killglue
   \use at par
   \pscustom[linestyle=none]{%
     \psline(#4,0)(#3,0)
     \psplot[liftpen=1]{#3}{#4}{x #5 #6 GAUSS}%
   }%
   \psplot[fillstyle=none]{#1}{#2}{x #5 #6 GAUSS}%
}\ignorespaces}
\makeatother

\begin{document}

\psset{xunit=2,yunit=4}
\begin{pspicture}(-2.4,0)(2.4,1)

% \psaxes*[par]{arrows}(x0,y0)(x1,y1)(x2,y2)

\psaxes[dx=1cm,Dx=1](0,0)(-1.5,.85)(1.5,0)

\psGauss[sigma=0.5]{-2}{2}    % default sigma=0.5

\end{pspicture}

\newpage

\psset{yunit=5cm, xunit=2cm}
\begin{pspicture}(-4,-0.1)(4,0.65)
   \psaxes[dy=0.2,Dy=0.2,linewidth=0.5pt]{->}(0,0)(-3.5,-0.1)(3.5,0.65)
   \psset{fillstyle=solid,plotpoints=100,linewidth=1pt}
   \psGaussFill[fillcolor=red](-3,3)(-2,-1.25){0}{0.9}
   \psGaussFill[fillcolor=blue](-3,3)(.5,1.5){0.5}{0.9}
\psGaussFill[fillcolor=red](-3,-1)(-2,-1.25){0}{0.9}

\end{pspicture}

\end{document}



Doug Mounce, Manager, UW MRFM Program, 206.543.1720,  http:// 
www.mrfm.org





More information about the PSTricks mailing list