Closed
Description
The facet order is broken when adding a new layer with new data.
library(ggplot2)
set.seed(123)
d <- data.frame(x=1:15, y=rnorm(15), f=factor(rep(letters[1:3],
each=5), levels=letters[1:3]))
## all fine, facets are a, b, c
( p <- ggplot(d, aes(x, y)) + facet_grid(f~.)+
geom_path() )
d2 <- data.frame(x=2, y=2, f="b",
stringsAsFactors=FALSE) # to be sure
## now the facets are in a different (wrong) order!
p + geom_blank(data=d2)