ggannotate_npc: Create an annotation layer with text or label annotation

View source: R/ggannotate_npc.R

ggannotate_npcR Documentation

Create an annotation layer with text or label annotation

Description

This function Creates an ggplot2 object with annotation.

Usage

ggannotate_npc(
  geom = "text",
  label,
  label_position = "lefttop",
  label_justification = NULL,
  ...,
  na.rm = FALSE
)

Arguments

geom

character Name of geom to use for annotation. Can be one of "text" and "label".

label

the character which will be added to the plot, will be connected by stringr::str_c(names(label), label), collapse = label_sep, sep = ": "

label_position

the position where the label will added, can be a numeric vector of length two or a character vector with length one (one of "lefttop", "righttop", "leftbottom", and "rightbottom") or length two (See below label_justification). Default: "lefttop".

label_justification

label_justification must be a element-two (or one) character or numeric vector. Possible string values are: "left", "right", "centre", "center", "bottom", and "top". For numeric values, 0 means left (bottom) alignment and 1 means right (top) alignment.

...

Other arguments passed on to layer. These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat. See geom_text and geom_label.

na.rm

If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.

Value

a ggplot2 layer object with annotation

Author(s)

Yun yunyunpp96@outlook.com

Examples

ggannotate_npc(label = "a", label_position = c(0.5, 0.5))

Yunuuuu/yjtools documentation built on Jan. 29, 2024, 5:30 a.m.