ggpackets icon indicating copy to clipboard operation
ggpackets copied to clipboard

Nesting of ggpackets

Open dazu89 opened this issue 1 year ago • 1 comments

This is a mar-ve-lous package, thank you, for making it available to the wider public! Maybe it is not supposed to be used that way, but upon nesting packets, I am running into different issues. In this case ‹Error in rlang::quo_get_expr(): ! quo must be a quosure›

library(sf)
library(stars)
library(ggpackets)
library(dplyr)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
gg_p1= ggpacket() +
  geom_sf(data = nc)
gg_p1

gg_p2 = ggpacket() + 
  gg_p1 +
  geom_sf(data = nc[1,], fill = "red")
gg_p2

In other cases, which motivated this issue, I am unable to overwrite scale_x_continuous provided by a ggpackets or get other errors upon nesting such as ‹Error in (function (mapping = aes(), data, na.rm = TRUE, show.legend = NA, : argument "data" is missing, with no default› (this one is cryptic, as in no statement I did omit the data argument. Maybe I have overlooked something... in anycase, this would be a cool functionality and any advise is appreciated!

dazu89 avatar Sep 30 '24 22:09 dazu89

Thanks for filing this. I'll investigate. I can't promise a timeline, but I'll definitely get it back up and running.

dgkf avatar Oct 01 '24 01:10 dgkf

Hi there - finally getting around to addressing this. To be totally honest, my work doesn't involve much plotting these days so I've even forgot what is intended behavior here.

That said, there's a simple solution. When nesting a ggpacket(), make sure to use parentheses: ggpacket() + gg_p1() + ....

Even if there's a solution, I think the error message is totally unhelpful and I need to rediscover this package a bit to understand whether the no-parentheses style should be supported.

dgkf avatar Feb 28 '25 18:02 dgkf