tag_facet: tag_facet

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
tag_facet(p, open = "(", close = ")", tag_pool = letters, x = -Inf,
  y = Inf, hjust = -0.5, vjust = 1.5, fontface = 2, family = "",
  ...)

Arguments

p

ggplot

open

opening character, default: (

close

closing character, default: )

tag_pool

character vector to pick tags from

x

x position within panel, default: -Inf

y

y position within panel, default: Inf

hjust

hjust

vjust

vjust

fontface

fontface

family

font family

...

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)
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)

baptiste/egg documentation built on May 30, 2021, 1:24 a.m.