Learn R Programming

ggdistribute (version 1.0.3)

label_plot: Add labels to existing plot

Description

Uses a normalized coordinate system to add text anywhere on the current plot.

Usage

label_plot(labels, x, y, g = list(fontsize = 14, fontface = "bold"), ...)

Arguments

labels

character vector of labels to use

x

horz positions of items in labels

y

vert positions of items in labels

g

list of options passed to grid::gpar

...

optional args passed to grid::grid.text

Value

NULL. prints to current graphics device.

See Also

grid::grid.text, grid::gpar

Examples

Run this code
# NOT RUN {
example_plot()
label_plot(c('a label', 'another one'), c(.1, .9), c(.95, .1))

# use extra options from grid::grid.text
label_plot('last one', 0.5, 0.5, just='center')
# }

Run the code above in your browser using DataLab