Skip to content

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

3 messages · Hadley Wickham, Juliet Hannah

#
This example works now, but does the legend need to be updated
manually? After we specify the color change, it does not appear in the
legend. Thanks!
On Wed, Sep 24, 2008 at 8:03 PM, hadley wickham <h.wickham at gmail.com> wrote:
#
Hi Juliet,

Can you please provide a reproducible example of the problem?

Thanks,

Hadley
On Wed, Dec 31, 2008 at 10:14 AM, Juliet Hannah <juliet.hannah at gmail.com> wrote:

  
    
#
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!