new_reflines: Add a reference lines shape to a plot

View source: R/new_simples.R

new_reflinesR Documentation

Add a reference lines shape to a plot

Description

A reference lines shape is a collection of lines going from edge to edge of a plotting region (without regard to any pad reserved around the edges of the region) that use the same subset of locating arguments (x1, y1, a, i, s, x2, y2, and au). Reference lines can be defined in a variety of ways as described in the defining reference lines section.

Usage

new_reflines(
  pj,
  x1,
  y1,
  ref = "i",
  x2 = NA,
  y2 = NA,
  s = NA,
  i = NA,
  a = NA,
  au = "r",
  region = ".",
  look = NULL,
  mod = NULL,
  name = "."
)

Arguments

x1

NA or a numeric vector indicating either a vertical reference line at the value contained in x1 (if used alone) or the horizontal location of a primary point used to define a reference line (if used with y1).

y1

NA or a numeric vector indicating either a horizontal reference line at the value contained iny1 (if used alone) or the vertical location of a primary point used to define a reference line (if used with x1).

ref

NA or a character vector giving pre-defined reference lines where 'i' indicates the identity line 'x' indicates the x-axis, and 'y' indicates the y-axis.

x2

NA or a numeric vector indicating the horizontal locations of secondary points to define lines in conjunction with x1, y1, and y2.

y2

NA or a numeric vector indicating the vertical locations of secondary points to define lines in conjunction with x1, y1, and x2.

s

NA or a numeric vector indicating the slope of each reference line.

i

NA or a numeric vector indicating the x-intercept of each reference line.

a

NA or a numeric vector indicating the angle of each reference line.

au

NA or a character vector indicating the angle units to be used where 'd' indicates degrees, 'g' indicates gradians, 'p' indicates proportion of a full revolution, and 'r' indicates radians.

Value

pj with the addition of the specified refline shape(s).

Using look to make shapes appear

By itself, this function simply defines the location of x-y pairs in the assigned region for the specified shape. Various looks can be added to the shape using the look parameter or via the add_lines function. The sub-list of the look argument must be named 'line'.

Argument recycling

The argument set {ref, x1, y1, x2, y2, s, i, a, au} is recycled.

Defining reference lines

Valid combinations of non-NA locating arguments are given below.

ref

Pre-defined reference line

x1

Vertical line at x1.

y1

Horizontal line at y1.

x1 + y1 + x2 + y2

Point-point definition (line through (x1, y1) and (x2, y2)).

x1 + y1 + a

Point-angle definition (line through (x1, y1) at angle a).

x1 + y1 + i

Point-intercept definition (line through intercept and (x1, y1)).

x1 + y1 + s

Point-slope definition (line through (x1, y1) with slope s).

a + i

Angle-intercept definition (line through intercept at angle a).

s + i

Slope-intercept definition (line through intercept with slope s.

See Also

Other new_simples: new_points(), new_segments()


j-martineau/pj documentation built on March 19, 2022, 5:32 a.m.