You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When data=NULL, it should inherit data, not replace it with a data frame with one row per panel.
# Should have no red points
qplot(mpg, wt, data=mtcars) + geom_point(data=data.frame(), x=20, y=3, colour="red", size=5, alpha=.1)
# Should have many red points overplotted - presently only has one red point
qplot(mpg, wt, data=mtcars) + geom_point(data=NULL, x=20, y=3, colour="red", size=5, alpha=.1)
# Should have many red points overplotted in each facet, one for each black point in that facet.# Presently has only one red point per facet.
qplot(mpg, wt, data=mtcars) + geom_point(data=NULL, x=20, y=3, colour="red", size=5, alpha=.1) +
facet_wrap(~cyl)
I think the problem is in compute_aesthetics() in layer.r.
Here are the tests that it should pass (should go in test-empty-data.r):
# NULL should inherit data
d <- pdata(ggplot(mtcars, aes(x=mpg, y=wt)) + geom_point() +
geom_point(data=NULL, x = 20, y = 3, colour = "red", size = 5))
expect_equal(nrow(d[[1]]), nrow(mtcars))
expect_equal(nrow(d[[2]]), nrow(mtcars))
d <- pdata(ggplot(mtcars, aes(x=mpg, y=wt)) + geom_point() +
geom_point(data=NULL, x = 20, y = 3, colour = "red", size = 5) +
facet_wrap(~ cyl))
expect_equal(nrow(d[[1]]), nrow(mtcars))
expect_equal(nrow(d[[2]]), nrow(mtcars))
expect_equal(sort(d[[1]]$PANEL), sort(d[[2]]$PANEL))
The text was updated successfully, but these errors were encountered:
When
data=NULL
, it should inheritdata
, not replace it with a data frame with one row per panel.I think the problem is in
compute_aesthetics()
in layer.r.Here are the tests that it should pass (should go in test-empty-data.r):
The text was updated successfully, but these errors were encountered: