facet_grid rows~cols reversed and facet_wrap nrow issue

21 views
Skip to first unread message

Allan

unread,
Jun 29, 2011, 8:29:08 AM6/29/11
to Deducer
Dear all,
It looks to me that the rows and columns boxes are reversed in
facet_grid compared with the call that I expected of facets = rowvar ~
colvar.

In addition, when using facet_wrap - Wrap options, it appears as
though # of rows is currently only added to the call or updated when
changed if ncol is specified although you can specify or update ncol
without specifying nrow.

Thanks, Deducer is a great tool!
-Allan

R version 2.13.0 (2011-04-13)
Platform: i386-pc-mingw32/i386 (32-bit)

other attached packages:
[1] Deducer_0.4-5 foreign_0.8-44 effects_2.0-12
colorspace_1.1-0
[5] nlme_3.1-101 lattice_0.19-26 multcomp_1.2-6
mvtnorm_0.9-9991
[9] car_2.0-10 survival_2.36-9 nnet_7.3-1
MASS_7.3-13
[13] ggplot2_0.8.9 proto_0.3-9.2 reshape_0.8.4
plyr_1.5.2
[17] JGR_1.7-7 iplots_1.1-3 JavaGD_0.5-4
rJava_0.9-0

Bob Muenchen

unread,
Jan 7, 2012, 11:46:42 AM1/7/12
to ded...@googlegroups.com
I just came across the row vs. column reversal. When I was trying to reproduce Fig. 3.6 in Hadley's ggplot2 book, I filled in year as the column variable and the plot appeared with year in the rows instead. This was the code Plot Builder wrote:

ggplot() +
    geom_point(aes(x = displ,y = hwy),data=mpg,alpha = 0.5952) +
    geom_smooth(aes(x = displ,y = hwy),data=mpg,method = 'loess',formula = 'y ~ x') +
    facet_grid(facets = year ~ .)

Flipping year into the column position worked fine:

ggplot() +
    geom_point(aes(x = displ,y = hwy),data=mpg,alpha = 0.5952) +
    geom_smooth(aes(x = displ,y = hwy),data=mpg,method = 'loess',formula = 'y ~ x') +
    facet_grid(facets = . ~ year)

Ian Fellows

unread,
Jan 9, 2012, 3:41:54 PM1/9/12
to ded...@googlegroups.com
I thought I had fixed this some time ago, but I guess not. Fixed in
dev now. Will be in next version of deducer.

Ian

Reply all
Reply to author
Forward
0 new messages