labeller() and related functionality give huge flexibility for controlling strips, thanks! But I've been asked to write an extension that programmatically modifies strip text font size in the event that a strip has many lines. At present it is hard to examine strip text in advance. Apparently labeller() is called once during build_strip() and the result is immediately rendered as grobs. Stealing ideas from https://github.com/yjunechoe/ggtrace I can do invisible(ggplotGrob(x)) while running trace() on build_strip(), but the latter is not exported so there is going to be a package check warning that will probably keep the solution from ever posting on CRAN.
I completely understand if you do not want to export build_strip(). Is there an alternative way, existing or otherwise (feature request), to view the facet label text of a ggplot object before rendering?
debug(ggplot2:::build_strip) # labels near line 12
ggplot(mtcars, aes(wt, mpg)) + geom_point() + facet_grid(cyl ~ am + gear)
labeller()and related functionality give huge flexibility for controlling strips, thanks! But I've been asked to write an extension that programmatically modifies strip text font size in the event that a strip has many lines. At present it is hard to examine strip text in advance. Apparentlylabeller()is called once duringbuild_strip()and the result is immediately rendered as grobs. Stealing ideas from https://github.com/yjunechoe/ggtrace I can doinvisible(ggplotGrob(x))while runningtrace()onbuild_strip(), but the latter is not exported so there is going to be a package check warning that will probably keep the solution from ever posting on CRAN.I completely understand if you do not want to export
build_strip(). Is there an alternative way, existing or otherwise (feature request), to view the facet label text of a ggplot object before rendering?