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

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Sun Nov 17 00:11:38 CET 2019


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

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testData.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20191117/8f04e41f/attachment.txt>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 12321 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20191117/8f04e41f/attachment.pdf>


More information about the R-help mailing list