给整张拼图加标题、编号和脚注

函数索引 / 拼图
annotation_forma()
可在同一张拼图中使用中英文总标题、数学公式和带格式的脚注。
怎么用
先完成排版,再用 + 加到整张拼图上。选 format = 'mixed' 后可在美元符号内写 plotmath。用 tag_levels = 'A' 生成字母编号。
返回结果
返回可加到拼图上的 patchwork 注释对象。
调用方式
annotation_forma(
title = ggplot2::waiver(),
subtitle = ggplot2::waiver(),
caption = ggplot2::waiver(),
format = c("markdown", "plain", "mixed"),
family = NULL,
lang = NULL,
text_direction = "auto",
width = NULL,
tag_levels = ggplot2::waiver(),
tag_prefix = ggplot2::waiver(),
tag_suffix = ggplot2::waiver(),
tag_sep = ggplot2::waiver(),
theme = NULL
)参数
title, subtitle, caption、format、family、lang、text_direction、width、tag_levels, tag_prefix, tag_suffix, tag_sep、theme
R 示例
p <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point()
figure <- (p | p) + annotation_forma(
title = "**Fuel economy**", subtitle = "Mean: $bar(x)$",
caption = "**Source**: mtcars", format = "mixed", tag_levels = "A"
)
if (capabilities("cairo")) {
ggplot2::ggsave(tempfile(fileext = ".pdf"), figure, device = grDevices::cairo_pdf,
width = 180, height = 110, units = "mm")
}