inc<-0.085 p<-c("red","blue","green","purple","brown","pink","seagreen2","violet","orange", "turquoise") # a vector of colours for each mean value plot(NULL,xlim=c(0,20),ylim=c(0,0.4),xlab="X",ylab="Poisson (x)") for (i in 1:10){ for(j in 0:20){ lines(c(j+(i-1)*inc,j+(i-1)*inc), c(0,dpois(j,i)),lwd=3, col=p[i]) }} par(new=TRUE) for (i in 1:10) {lines((0:20)+(i-1)*inc, dpois(0:20,i), col=p[i])} legendLabels=c(paste("mean =",1:10)) # we want a space after = so collapse not used legend("topright",inset=0.05, legend=legendLabels, col= c("red","blue","green","purple", "brown","pink","seagreen2","violet","orange","turquoise"), lty=1,cex=0.8)