lemon
lemon copied to clipboard
Idea: Strip text search
To find a strip (any?) grob with a particular label. Question is, what to return? It is essentially a tree-path to the grob.
Code from a project that searches for 'Overall' and updates the gpar to bold.
# find strip overall and make bold
i <- (grepl('strip', g$layout$name) & !sapply(g$grobs, lemon:::is.zero)) %>% which
j <- which(sapply(g$grobs[i], function(x) x[[1]][[1]]$children[[2]]$children[[1]]$label, simplify=FALSE) == 'Overall')
g$grobs[[i[j]]]$grobs[[1]]$children[[2]]$children[[1]]$gp$fontface <- 'bold'
g$grobs[[i[j]]]$grobs[[1]]$children[[2]]$children[[1]]$gp$font <- c('bold'=2L)