nsample<-10; pb<-0.5; ndata<-0:nsample
bddata<-vector(mode="numeric"); pbdata<-vector(mode="numeric")
for(i in 0:nsample){
  bddata[i+1]<-dbinom(i, nsample, pb, log = FALSE)
  pbdata[i+1]<-pbinom(i, nsample, pb, log.p = FALSE)
}
#---------plot of dbinom, binom --------------
xrange<-c(0,nsample); yrange<-c(0,1)
vsum<-sprintf("%.5f",bddata); vprb<-sprintf("%.5f",pbdata)
plot(ndata,pbdata,xlim=xrange,ylim=yrange,ylab="",col="blue")
text(ndata,pbdata,labels=vsum,pos=3,offset=0.1,col="blue",cex=0.7)
points(ndata,bddata,col="red",pch=16)
text(ndata,bddata,labels=vprb,pos=1,offset=0.1,col="red",cex=0.7)
