[R] Ploting two datasets

Petr Pikal petr.pikal at precheza.cz
Thu May 25 08:16:03 CEST 2006


Hi

On 25 May 2006 at 0:25, Anderson de Rezende Rocha wrote:

Date sent:      	Thu, 25 May 2006 00:25:46 -0300 (ART)
From:           	Anderson de Rezende Rocha <phiberoptic_br at yahoo.com.br>
To:             	r-help at stat.math.ethz.ch
Subject:        	[R] Ploting two datasets

> Dears, 
> 
> I need your help. I have two sets A and B each one containing 
> n lines and being composed by the atributes x and y. 

Well do you really mean attributes? Maybe they are data frames.

> 
> Three questions:
> 1) How can I plot A and B both on the same graphic? I need to show 
>    that the classes A and B are separable. In this way, I need 
>    to plot the points of A as "*", and the points of B as "+", for  
>    example. This would result two clouds. 

A<-data.frame(x=1:10, y=rnorm(10)
B<-data.frame(x=1:10, y=rnorm(10)*10

plot(A$x, A$y, ylim=range(A$y, B$y), pch=8)
points(B$x, B$y, ylim=range(A$y, B$y), pch=3)

or maybe you could use Rgobi (Ggobi).

> 
> 2) How can I plot the result of question one using multi-levels, that 
>    is, a set of ellipsis that start on the mean of A and on the 
>    mean of B? 

see package elipse or make your own function which takes means and 
draws an ellipse with some setted axes

> 
> 3) How can I trace an hiperplane separating the classes A and B just 
>    depicted in question 1?
> 
> I appreciate any help. Thanks for all.
> 
> ______________________________________________
> R-help at 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

Petr Pikal
petr.pikal at precheza.cz



More information about the R-help mailing list