I need to include more species to the iris data set, the following plot only presents three species. How Can I make the code more flexible to include more than three species?

I need to include more species to the iris data set, the following plot only presents three species. How Can I make the code more flexible to include more than three species?

 
    
     
    
    You are plotting the points on a single graph. You do not need a loop:
clrs <- rainbow(length(levels(iris$Species)))
plot(Petal.Width~Petal.Length, iris, main="My Graph", xlab="Petal Length", ylab="Petal Width", col=clrs[as.numeric(iris$Species)])
legend("topleft", legend=levels(iris$Species), pch=1, col=clrs)
