tag_facet_outside: tag_facet_outside

Description Usage Arguments Value Examples

View source: R/tag_facet.r

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

1
2
3
4
5
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)

egg documentation built on July 13, 2019, 9:03 a.m.