[R] pairs() Legend
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Sep 25 14:29:52 CEST 2001
Ko-Kang Kevin Wang wrote:
>
> Hi,
>
> Is it possible to create a legend in a pairs() plot?
>
> For example, suppose I have the following R codes:
>
> data(iris)
> pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",
> pch = 21, bg = c("red", "green3", "blue")[codes(iris$Species)])
>
> How can I created a legend that shows which colour represents to which
> Iris species?
What about something like
data(iris)
pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",
pch = 21, bg = c("red", "green3", "blue")[codes(iris$Species)])
par(xpd=TRUE)
legend(0, 1, as.vector(unique(iris$Species)),
fill=c("red", "green3", "blue"))
Uwe Logges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list