[R] How to color a splom?

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri Jan 15 14:44:21 CET 2010



On 14.01.2010 11:11, Marius Hofert wrote:
> Dear R-Users,
>
> I would like to color the data in a splom according to their position in the matrix, i.e. I would like to have all data shown in the upper left corner to be blue, all entries below that to be black, and the data to the right to be all red. I tried to color the "splom" with the following call...
>
> splom(~iris[1:3],col=c("black","blue","red"))
>
> ...however, the colors are mixed. I also constructed a matrix containing the required colors, but that also did not work. How do I color the splom according to the location in the matrix as mentioned above?

Do you mean color by the levels of Species?

  splom( ~ iris[1:3], col = c("black","blue","red")[iris[,4]])

Best wishes,
Uwe



> Cheers,
>
> Marius
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list