tag_facet.RdAdds a dummy text layer to a ggplot to label facets and sets facet strips to blank. This is the typical formatting for some journals that consider facets as subfigures and want to minimise margins around figures.
tag_facet(p, open = "(", close = ")", tag_pool = letters, x = -Inf,
y = Inf, hjust = -0.5, vjust = 1.5, fontface = 2, family = "",
...)ggplot
opening character, default: (
closing character, default: )
character vector to pick tags from
x position within panel, default: -Inf
y position within panel, default: Inf
hjust
vjust
fontface
font family
further arguments passed to geom_text layer
plot with facet strips removed and replaced by in-panel tags
library(ggplot2)
mydf = data.frame(
x = 1:90,
y = rnorm(90),
red = rep(letters[1:3], 30),
blue = c(rep(1, 30), rep(2, 30), rep(3, 30)))
p <- ggplot(mydf) +
geom_point(aes(x = x, y = y)) +
facet_wrap(
~ red + blue)
tag_facet(p)
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#> ℹ Please use tidy evaluation idioms with `aes()`.
#> ℹ See also `vignette("ggplot2-in-packages")` for more information.
#> ℹ The deprecated feature was likely used in the egg package.
#> Please report the issue to the authors.