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:
On Wed, Sep 24, 2008 at 7:57 PM, <rmailbox at justemail.net> wrote:
I have a more complicated function I am trying to write, but I run in to a problem when I want to add something to the plot from more than one data set while simultaneously controlling the appearance of the additional layer. # Toy data: 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 ) ) # This works, and produces a sensible (unified!) legend: foo.gg <- ggplot ( mapping = aes ( x = x, y = y , colour = membership ) ) foo.gg <- foo.gg + geom_point(data = foo) foobar.gg <- foo.gg + geom_point ( data = bar ) # works fine, creates a unified scale showing "membership" foobar.gg # This does not work: booboo.gg <- foo.gg + geom_point ( data = bar, colour = "black" ) # so far, so good, but... booboo.gg # it will not let me over-ride the colour specifications when it actually tries to construct the graph The error message is: "Error in `[.data.frame`(df, , var) : undefined columns selected" System Information: R version 2.7.2 (2008-08-25) i386-pc-mingw32 ggplot2_0.6 My goal is to be able to add the additional layer and control its appearance separately from the appearance of the first layer. Possible?
This is a bug that caused by an interaction with a bug fix in R 2.7.2. Its fixed in the development version, and I'm working hard to get a new release out as soon as possible. Hadley -- http://had.co.nz/
______________________________________________ R-help at 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.