Coloring points in a pairs plot

前端 未结 2 615
挽巷
挽巷 2021-02-08 22:37

I would like to color points in a pairs plot based of certain row indexes. Here is the code I used for plotting 1 variable against another.

cases<-which(rown         


        
2条回答
  •  长情又很酷
    2021-02-08 23:19

    Something like this?

    cols <- character(nrow(iris))
    cols[] <- "black"
    
    cols[iris$Species %in% c("setosa","versicolor")] <- "blue"
    cols[iris$Species == "virginica"] <- "red"
    pairs(iris,col=cols)
    

提交回复
热议问题