Skip to content
Prev 381877 / 398502 Next

Still struggling with facet_grid_paginate() from package ggforce.

On 2/12/19 10:45 am, Rui Barradas wrote:

            
Indeed it did.  You are brilliant, Rui. Problem solved.

I note that one can, I think, calculate the number of pages a priori,
thus avoiding two calls to ggplot(), in something like the following manner:

nface <- with(Dat,prod(sapply(condVars,
                        function(x){length(levels(get(x)))})))

npgs  <- ceiling(nface/(nrow*ncol))

where Dat is the data frame of data being plotted and condVars is a 
vector of the names of the variables being conditioned on (i.e. the 
variables determining the facets).  In the example that I provided,
condVars would just be "Trt", but it all seems to work in settings in 
which there is more than one conditioning variable.

Thanks very much.

cheers,

Rolf