Hi I am trying to color under the line above 25 on the x axis and it either not showing anything or giving me error, x and y are different length any help would be great Thanks Rob

Hi I am trying to color under the line above 25 on the x axis and it either not showing anything or giving me error, x and y are different length any help would be great Thanks Rob

 
    
     
    
    You need to start with some plot. polygon just adds to an existing plot. 
Also, You need to include a few extra points to get the area under the curve, not over. 
x2 = c(x, 40, 25)
y2 = c(y, 0, 0)
plot(x,y, type="n")
polygon(x2,y2, col="yellow")
 
    
    Here is another way.
x <- 25:40
y <- dpois(x, 23.83)
plot(x, y, type = "n")
polygon(c(x, rev(x)), c(y, rep(0, length(y))), col = "yellow")
