ggforce icon indicating copy to clipboard operation
ggforce copied to clipboard

facet_wrap_paginate - Error: Cannot create zero-length unit vector ("unit" subsetting)

Open pausoto7 opened this issue 3 years ago • 2 comments

After updating R and its associated packages (ggforce, ggplot etc), facet_wrap_paginate no longer works when I only have one plot for the page. Previously having one plot and nrow =2, and ncol = 2 worked fine, but now when I do this I get "Error: Cannot create zero-length unit vector ("unit" subsetting)" . I found that I can have nrow = 2, but with any number greater than 1 for ncol the code breaks. I tested this with pages that have numerous plots and it works fine then.

          p1 <-  Specific_TS %>%
            ggplot(aes(x=DateTime,y=summary_value)) +
            geom_point()+
            geom_line() +
            facet_wrap_paginate(clean_name~Location, nrow = 5, 
                                ncol = 5, 
                                page = pages)


         print(p1)

Error: Cannot create zero-length unit vector ("unit" subsetting)

pausoto7 avatar Oct 16 '20 18:10 pausoto7

Any update on this?

farhadsalimi avatar Sep 09 '21 10:09 farhadsalimi

@farhadsalimi, I downloaded the ggforce package and modified facet_wrap_paginate.R based on @crotoc's suggestion. I followed these instructions (for Linux Environment) to download, edit, rebuild, and reinstall the package. Seems to have solved the problem, at least for my specific needs.

billytheblock avatar Sep 13 '21 11:09 billytheblock

This seems to be fixed in the latest versions

thomasp85 avatar Sep 02 '22 06:09 thomasp85