Hi, 

the blue point is not shown simply because it is printed outside 
the current plot area. If you want to use the base graphics, you 
have to manually define the xlim and ylim of the plot. Legend is added 
with the command "legend". 

E.g.
x=rbind(c(10,11),c(10,11))
y=cbind(-1:0,-1:0)
plot(y,col='yellow', xlim=c(-1,11), ylim=c(-1,11))
points(x,col='blue')
legend("topleft", c("x","y"), col=c('blue', 'yellow'), pch=1)

This is nevertheless most easily done in ggplot2. 
E.g.
library(ggplot2)
# put the whole data in a data frame
# and add a new variable to distinguish both
dat <- data.frame(rbind(x,y), var=rep(c('x','y'), each=2))
qplot(x=X1,y=X2, colour=var, data=dat)


HTH, 

Matthieu

______________________________________________
R-help@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.

Reply via email to