Learn R Programming

cowplot (version 0.4.0)

draw_text: Draw text.

Description

This is a convenience function. It's just a thin wrapper around geom_text(). It can take either an individual piece of text to be drawn or a vector of separate text labels, with associated coordinates.

Usage

draw_text(text, x = 0.5, y = 0.5, size = 14, ...)

Arguments

text
Character or expression vector specifying the text to be written.
x
Vector of x coordinates.
y
Vector of y coordinates.
size
Font size of the text to be drawn.
...
Style parameters, such as colour, alpha, angle, size, etc.

Details

Note that font sizes get scaled by a factor of 2.85, so sizes given here agree with font sizes used in the theme. This is different from geom_text in ggplot2.

By default, the x and y coordinates specify the center of the text box. Set hjust = 0, vjust = 0 to specify the lower left corner, and other values of hjust and vjust for any other relative location you want to specify.