[R] R-help Digest, Vol 35, Issue 7

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jan 7 17:09:41 CET 2006


Evgeniy Kachalin wrote:

> Hello, dear participants!
> 
> Could you tip me, is there any simple and nice way to build scatter-plot 
> for three different types of data (, and o and * - signs, for example) 
> with legend.
> 
> Now i can guess only that way:
> 
> plot(x~y,data=subset(mydata,factor1=='1'), pch='.',col='blue')
> points(x~y,data=subset(mydata,factor1=='2'), pch='*',col='green')
> points(.... etc
> 
> What is the simple and nice way?
> Thank you very much for your kindness and help.
> 


Example:


with(iris,
   plot(Sepal.Length, Sepal.Width, pch = as.integer(Species)))
with(iris,
   legend(7, 4.4, legend = unique(as.character(Species)),
                     pch = unique(as.integer(Species))))


Uwe Ligges




More information about the R-help mailing list