Using Base R

Use the plot and dbinom commands. For example, to obtain the graph of a binomial probability distribution with n = 20 and p = 0.2.

plot(dbinom(1:20, 20, 0.2), type='h', xlab = "x", ylab = "Probability")

The graph is skewed right as we would expect because p < 0.5.

Using Mosaic

If necessary, install the Mosaic package.

install.packages("mosaic")
library(mosaic)
gf_dist('binom',size=20,prob=0.2,xlim=c(-1,21))

Notice that Mosaic only draws the graph up to x = 12 because for all x greater than 12 the probability is very small.