Skip to content
Prev 381737 / 398502 Next

Can't get facet_grid_paginate() from ggforce to work.

Clearly there's something that I'm not understanding, but 
facet_grid_paginate() seems to be ignoring the "ncol" argument.

Here's a reprex:

library(ggforce)
X <- dget("testData.txt")
ncols <- length(levels(X$LifeStage))
npages <- length(levels(X$degC))
plotObj <- vector("list",npages)
for(page in 1:npages) {
plotObj[[page]] <- ggplot(X) +
     geom_point(aes(y = Sfrac , x = x)) +
     facet_grid_paginate(facets=Species~LifeStage:degC,
                         page=page,ncol=ncols)+
     ylab("Success fraction") +
     theme_bw()
}

The data set "testData.txt" is attached.

You will see if you "print" plotObj[[1]] that the plot has 8 columns, 
not 4 (4 being the value of "ncols").

The first and second pages seem to be identical; facet_grid_paginate() 
has put everything on one page, and then repeated that page.

I must be doing something utterly stupid, but I can't see what it is.

The example given in the help for ggforce, using the diamonds data, 
looks to me just like my example, except that it works and my example 
doesn't! What am I missing?

What I'm after is something like the plot in the attached pdf file
test.pdf (which I managed to produce using lattice).

Can anyone point me in the right direction?

Thanks.

cheers,

Rolf Turner