facet reordering with new layer+data?

12 views
Skip to first unread message

baptiste auguie

unread,
May 7, 2012, 12:50:18 AM5/7/12
to ggplot2-dev
Dear list,

I am very puzzled by this odd behaviour,

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)

Is this a known bug? Have I got a broken github install?

Thanks,

baptiste

> sessionInfo()
R version 2.15.0 Patched (2012-03-31 r58891)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ggplot2_0.9.0

loaded via a namespace (and not attached):
[1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2
grid_2.15.0 labeling_0.1 MASS_7.3-18 memoise_0.1
munsell_0.3
[9] plyr_1.7.1 proto_0.3-9.2 RColorBrewer_1.0-5
reshape2_1.2.1 scales_0.2.0.3 stringr_0.6 tools_2.15.0

Hadley Wickham

unread,
May 7, 2012, 7:30:45 AM5/7/12
to baptiste auguie, ggplot2-dev
Looks like a bug. Can you please file a bug report?
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

baptiste auguie

unread,
May 7, 2012, 7:50:22 AM5/7/12
to Hadley Wickham, ggplot2-dev
done (#543), thanks.

baptiste
Reply all
Reply to author
Forward
0 new messages