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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to