add_ci: Add a confidence interval look to a shape.

View source: R/add_look.R

add_ciR Documentation

Add a confidence interval look to a shape.

Description

Confidence interval looks can only be added to point shapes.

Usage

add_ci(
  pj,
  m,
  type = "line",
  dir = "v",
  d = NA,
  pos = NA,
  neg = NA,
  shape = ".",
  name = "."
)

Arguments

pj

an object of class 'pj'.

m

positive numeric vector of length recyclable with x and y defining the multiplier to apply to confidence interval distances in d or pos and neg.

type

'line', 'cap', 'taper', or 'ribbon'. See the types of confidence intervals section.

dir

'h' for horizontal intervals or 'v' for vertical intervals.

d

NA or a positive numeric vector of length recyclable with x and y defining the symmetric positive/negative error magnitude at each midpoint. See the d, pos, and neg arguments section.

pos

NA or positive numeric vector of length recyclable with x and y defining positive error magnitude at each midpoint. See the d, pos, and neg arguments section.

neg

NA or positive numeric vectors of length recyclable with x and y defining negative error magnitude at each midpoint. See the d, pos, and neg arguments section.

shape

character scalar indicating the type of shape to which the look will be applied.

Value

pj with the addition of the confidence interval look applied to the specified points shape.

Types of confidence intervals


line
A line confidence interval is simply a line between the minimum point of a confidence interval and its maximum point.

cap
A capped-line confidence interval is a line interval with a cap at the ends of the line.

taper
A tapered confidence interval is a thin polygon thickest at the middle of the confidence interval and narrowing to zero width at the lower and upper bounds of the interval.

ribbon
A ribbon confidence interval is a polygon defined by the area between minimum and maximum values of confidence intervals for a sorted series of points.

The d, pos, and neg arguments

Either d must be supplied or both pos and neg must be supplied.

Valid combinations of argument properties

Intervals can be validly described using a number of patterns of argument properties as follows:

x + y + m + dir + type + d

symmetric confidence interval of width 2dm

.

x + y + m + dir + type + neg + pos

non-symmetric confidence interval of width m(pos + neg)

.

Argument recycling

The argument d or the arguments pos and neg are recycled with the values of x and y associated with the points shape the confidence interval is to be applied to.

See Also

Other add_look: add_ends(), add_fills(), add_glyphs(), add_labels(), add_lines(), add_marks()


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