For example, prepare like this > df.0 <- data.frame(x = 0, y = 0, note = "1") > df.1 <- subset(df.0, note == "1") > df.2 <- subset(df.0, note == "2")
Then a call to > ggplot() + aes(x = x, y = y) + > geom_point(data = df.1) + geom_point(data = df.2) produces the error > Error in eval(expr, envir, enclos) : object 'x' not found And a call to > ggplot(df.1, aes(x = x, y = y, shape = 4)) + > geom_point() + geom_point(aes(shape = 1), df.2) plots both a cross (shape = 4) and circle (shape = 1) on position (0, 0). However, as expected, only a cross should be plotted because `dt.2' is empty. So with the current behaviour, if someone writes a script to plot datasets automatically and distinguish between subsets, he will need to write different code path for empty and non-empty data subsets. I think ggplot2 can just choose to "plot nothing" for empty data subsets, and only produce error when the dataset (union of a subsets) to plot is completely empty. This can make scripting easier based on ggplot2. -- Using GPG/PGP? Please get my current public key (ID: 0xAEF6A134, valid from 2010 to 2013) from a key server.
signature.asc
Description: Digital signature
______________________________________________ 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.