geom_annotate: Annotate Layer

View source: R/geom-annotate.R

geom_annotateR Documentation

Annotate Layer

Description

A wrapper funtion to add some annotate elements on ggplot.

Usage

geom_annotate(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "rt",
  show.legend = FALSE,
  ...,
  annotate = NULL,
  width = NULL,
  height = NULL,
  recycle = FALSE,
  na.rm = FALSE
)

annotateGrob(annotate, ...)

## S3 method for class 'grob'
annotateGrob(
  annotate,
  position = "rt",
  width = NULL,
  height = NULL,
  nudge_x = 0,
  nudge_y = 0,
  default.units = "npc",
  ...
)

## S3 method for class 'character'
annotateGrob(
  annotate,
  position = "rt",
  hjust = 0.5,
  vjust = 0.5,
  width = NULL,
  height = NULL,
  nudge_x = 0,
  nudge_y = 0,
  default.units = "npc",
  parse = FALSE,
  ...
)

## S3 method for class 'raster'
annotateGrob(
  annotate,
  position = "rt",
  width = 0.5,
  height = 0.5,
  nudge_x = 0,
  nudge_y = 0,
  default.units = "npc",
  ...
)

## S3 method for class ''magick-image''
annotateGrob(
  annotate,
  position = "rt",
  width = 0.5,
  height = 0.5,
  nudge_x = 0,
  nudge_y = 0,
  default.units = "npc",
  ...
)

## S3 method for class 'ggplot'
annotateGrob(
  annotate,
  position = "rt",
  width = 0.5,
  height = 0.5,
  nudge_x = 0,
  nudge_y = 0,
  default.units = "npc",
  ...
)

## S3 method for class ''NULL''
annotateGrob(annotate, ...)

## S3 method for class 'numeric'
annotateGrob(annotate, digits = 2, nsmall = 2, ...)

Arguments

mapping

Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

stat

The statistical transformation to use on the data for this layer, either as a ggproto Geom subclass or as a string naming the stat stripped of the stat_ prefix (e.g. "count" rather than "stat_count")

position

string, position of annotate:

  • "rt": right-top corner.

  • "rb": right-bottom corner.

  • "rc": right-center.

  • "lt": left-top corner.

  • "lb": left-bottom corner.

  • "lc": left-center.

  • "cc": center-center.

  • "ct": center-top.

  • "cb": center-bottom.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

...

other parameters passing to convert-function.

annotate

a grob object, or other object can be converted to a grob.

width, height

width/height of annotate.

recycle

if TRUE indicating annotate will repeated to the same length as rows of data.

na.rm

not used.

nudge_x, nudge_y

a minor shift of position, should be a grid::unit object.

default.units

A string indicating the default units to use.

hjust, vjust

a numeric vector specifying horizontal/vertical justification.

parse

if TRUE (default) will convert text to richtext.

digits

integer indicating the number of decimal places (round) to be used, the default value is 2.

nsmall

the minimum number of digits to the right of the decimal point, the default value is 2.

Value

a layer object.

Author(s)

Hou Yun


Hy4m/linkET documentation built on June 30, 2023, 7:39 p.m.