[R] ggplot: adding layer using different data, groups and also controlling appearance

Juliet Hannah juliet.hannah at gmail.com
Wed Dec 31 18:08:16 CET 2008


foo <- data.frame ( x = 1:4, y = 4:1 , membership = c( "A", "A", "B", "B" ) )
bar <- data.frame ( x = 1:4 + 1 , y = 4:1 + 1, membership = rep ( "C", 4 ) )

foo.gg <- ggplot ( mapping =  aes ( x = x, y = y , colour = membership ) )
foo.gg <- foo.gg + geom_point(data = foo)

booboo.gg <- foo.gg + geom_point ( data = bar, colour = "black" )
booboo.gg

Should "C" be updated manully. Thanks!



More information about the R-help mailing list