PL= iris$Petal.Length
PW= iris$Petal.Width
SL= iris$Sepal.Length
SW= iris$Sepal.Width
SP= iris$Species
Scol=c("red","green","blue")
names(Scol)= levels(SP)
pairs(iris[,1:4],col=Scol[SP])
legend("bottom",legend=levels(SP))
如何在pairs图上添加legend?根据不同species设置不同颜色图例。谢谢