title: R, graph of binomial distribution
body: <p>I have to write own function to draw the density function of binomial distribution and hence draw 
  appropriate graph when n = 20 and p = 0.1,0.2,...,0.9. Also i need to comments on the graphs.</p>
  
  <p>I tried this ;</p>
  
  <pre><code>   graph &lt;- function(n,p){
                 x &lt;- dbinom(0:n,size=n,prob=p)
                 return(barplot(x,names.arg=0:n))
              }
  
  
     graph(20,0.1)
     graph(20,0.2)
     graph(20,0.3)
     graph(20,0.4)
     graph(20,0.5)
     graph(20,0.6)
     graph(20,0.7)
     graph(20,0.8)
     graph(20,0.9)
  
     #OR
     graph(20,scan())
  </code></pre>
  
  <p>My first question : is there any way so that i don't need to write down the line <code>graph(20,p)</code> several times except using <code>scan()</code>?</p>
  
  <p>My second question :</p>
  
  <p>I want to see the graph in one device or want to hit <code>ENTER</code> to see the next graph. I wrote</p>
  
  <pre><code>   par(mfcol=c(2,5))
     graph(20,0.1)
     graph(20,0.2)
     graph(20,0.3)
     graph(20,0.4)
     graph(20,0.5)
     graph(20,0.6)
     graph(20,0.7)
     graph(20,0.8)
     graph(20,0.9)
  </code></pre>
  
  <p>but the graph is too tiny. How can i present the graphs nicely with giving head line n=20 and p=the value which i used to draw the graph?[though it can be done by writing <code>mtext()</code> after calling the function <code>graph</code>but doing so i have to write a similar line few times. So i want to do this including in function <code>graph</code>. ]</p>
  
  <p>My last question :</p>
  
  <p>About comment. The graphs are showing that as the probability of success ,p is increasing the graph is tending to right, that is , the graph is right skewed.</p>
  
  <p>Is there any way to comment on the graph using <code>program</code>?</p>