Error when trying to create an "empty" sticker (only with package name)
I'm trying to come up with a minimalist hex sticker, but I'm having some problems when creating an empty sticker (i.e. that contains just the package name). The first time I try to create it using sticker() it works fine, but any subsequent attempts raise an error. See the reprex below:
library(hexSticker)
a <- sticker(
subplot = ~ plot.new(),
package = "test",
filename = tempfile(fileext = ".png")
)
class(a)
#> [1] "sticker" "gg" "ggplot"
a <- sticker(
subplot = ~ plot.new(),
package = "test",
filename = tempfile(fileext = ".png")
)
#> Warning in editThisGrob(grob, specs): slot 'vp' not found
#> Warning in editThisGrob(grob, specs): slot 'name' not found
#> Error in UseMethod("validGrob"): no applicable method for 'validGrob' applied to an object of class "NULL"
Created on 2021-03-05 by the reprex package (v1.0.0)
Can confirm. Even the demo example fails with that same error when ran a second time in a fresh R session.
I've noticed that loading hexSticker loads a bunch of other packages that I'm not sure should be there. This is part of my sessionInfo() right after loading the package:
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 magrittr_2.0.1 sysfonts_0.8.3 tidyselect_1.1.1 munsell_0.5.0 lattice_0.20-44
[7] colorspace_2.0-1 R6_2.5.0 rlang_0.4.11 fansi_0.5.0 showtextdb_3.0 dplyr_1.0.6
[13] tools_4.1.0 grid_4.1.0 ggimage_0.2.8 gtable_0.3.0 utf8_1.2.1 ggplotify_0.0.7
[19] gridGraphics_0.5-1 ellipsis_0.3.2 tibble_3.1.2 lifecycle_1.0.0 crayon_1.4.1 BiocManager_1.30.15
[25] purrr_0.3.4 ggplot2_3.3.3 vctrs_0.3.8 glue_1.4.2 compiler_4.1.0 pillar_1.6.1
[31] magick_2.7.2 generics_0.1.0 rvcheck_0.1.8 scales_1.1.1 showtext_0.9-2 jsonlite_1.7.2
[37] hexbin_1.28.2 pkgconfig_2.0.3
Maaaybe that generates some conflict that triggers the reported issues?
It seems to be working with ggplot2::ggplot() + ggplot2::theme_void().