Add Label to a Fig

fig_lab(
  fig,
  lab,
  pos = "bottom",
  fontfamily = NULL,
  fontface = NULL,
  colour = NULL,
  size = NULL,
  lineheight = NULL,
  hjust = NULL,
  vjust = NULL,
  angle = NULL,
  margin = ggplot2::margin(4, 4, 4, 4)
)

Arguments

fig

Fig to be labelled.

lab

String of label to be added to the fig.

pos

Position of the fig, either 'top', 'bottom', 'left', or 'right'.

fontfamily

Font family for the label.

fontface

Font face for the label (i.e. "italic")

colour

Colour of the label text.

size

Size of the label text.

lineheight

Lineheight of the label text.

hjust

hjust of the label text.

vjust

vjust of the label text.

angle

Angle of the label text.

margin

Margin around the label text. Use ggplot2::margin()

Value

{ggplot2} object

Examples


library(figpatch)
library(ggplot2)

# Attach the fig image file
image <- system.file("extdata", "fig.png", package = "figpatch", mustWork = TRUE)

# Read in the image as a 'fig'
img <- fig(image)

# add the fig label
fig_lab(
  img,
  lab = "Below you will find a fig!",
  pos = "top",
  size = 20
)