unikn (version 0.1.0)

post: Post text (in an xbox).

Description

post plots 1 or more text strings (provided as a character vector labels) to an (existing or new) xbox.

Usage

post(labels, x = 0.03, y = 0.55, y_layout = "even", col = "white",
  col_bg = Seeblau, cex = 1, font = 1, new_plot = "none")

Arguments

labels

A character vector specifying the text labels to be plotted.

x

A numeric vector of x-coordinates at which the text labels in labels should be written. If the lengths of x and y differ, the shorter one is recycled. Default: x = .03.

y

A numeric vector of y-coordinates at which the text labels in labels should be written. If the lengths of x and y differ, the shorter one is recycled. Default: y = .55.

y_layout

A numeric value or vector for the vertical spacing of labels in labels. 2 special values are "even" (i.e., even distribution of labels across available y-space) and "flush" (i.e., no space between adjacent labels, or y_layout = 0). Default: y_layout = "even".

col

The color(s) of the text label(s). Default: col_lbl = "white".

col_bg

The background color(s) of the xbox. Default: col_bg = Seeblau.

cex

Numeric character expansion factor(s), multiplied by par("cex") to yield the character size(s). Default: cex = 1.0.

font

The font type(s) to be used. Default: font = 1 (i.e., plain text).

new_plot

Should a new plot be generated? Set to "xbox" to plot to a basic xbox (with square dimensions, i.e., dim = c(1, 1)). Default: new_plot = "none" (i.e., assumes a pre-existing xbox).

Details

The positions of the text elements in labels can be specified by providing their coordinates (as x and y arguments) or by providing an initial position and an y_layout (see below).

Text formatting parameters (like col, col_bg, cex, font) are recycled to match length(labels).

post uses the base graphics system graphics::.

See Also

xbox to create a new xbox (without text).

Other text functions: mark, uline, url_unikn

Examples

Run this code
# NOT RUN {
post(labels = "Post this line with default settings.", new_plot = "xbox")

# Create a new xbox: 
post(labels = "This is a test.", new_plot = "xbox", 
     cex = 1.2, font = 2, col_bg = pal_seeblau[[5]])

# Add text to an existing xbox: 
post(labels = c("More text follows here,",
              "yet another line here,",
              "and even more here."), 
              y = .4, y_layout = .04, 
              new_plot = "none")
                        
# }

Run the code above in your browser using DataCamp Workspace