tag_facet_outside {egg} | R Documentation |
tag_facet_outside
Description
Adds 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.
Usage
tag_facet_outside(p, open = c("(", ""), close = c(")", "."),
tag_fun_top = function(i) letters[i],
tag_fun_right = utils::as.roman, x = c(0, 0), y = c(0.5, 1),
hjust = c(0, 0), vjust = c(0.5, 1), fontface = c(2, 2),
family = "", draw = TRUE, ...)
Arguments
p |
ggplot |
open |
opening character, default: ( |
close |
closing character, default: ) |
tag_fun_top |
labelling function |
tag_fun_right |
labelling function |
x |
x position within cell |
y |
y position within cell |
hjust |
hjust |
vjust |
vjust |
fontface |
fontface |
family |
font family |
draw |
logical: draw the resulting gtable |
... |
further arguments passed to geom_text layer |
Value
plot with facet strips removed and replaced by in-panel tags
Examples
library(ggplot2)
d = 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(d) +
geom_point(aes(x = x, y = y)) +
facet_grid(red ~ blue)
tag_facet_outside(p)
[Package egg version 0.4.5 Index]