add_ends: Add an ends look to a shape.

View source: R/add_look.R

add_endsR Documentation

Add an ends look to a shape.

Description

An ends look is an end mark at the start, midpoint, and/or end of a line segment. End marks can be line-based arrows, triangle-based arrows, circles, diamonds, and squares.

Usage

add_ends(
  pj,
  segs = "a",
  ends = "e",
  mark = ">",
  size = 1,
  fc = "white",
  fa = 0.5,
  lc = "black",
  la = 0.5,
  lw = 1,
  shape = ".",
  name = "."
)

Arguments

pj

an object of class 'pj'.

mark

character scalar giving the type of end mark to plot. '>' indicates a line-only arrowhead end mark. 't' indicates an outlineable and fillable (triangular) arrrowhead end mark.'c' indicates an outlineable and fillable circular end mark, 'd' indicates an outlineable and fillable diamond end mark. Finally 's' indicates an outlineable and fillable square end mark, and

size

positive numeric vector indicating symbol size relative to the default (thus 1 indicates default sized, 1/2 indicates half sized, and 2 indicates double sized). For characters as marks, 1 indicates point size 10.

fc

NA or a character vector containing valid color representations giving the color used to fill end marks.

fa

NA or a numeric proportion vector (i.e., between 0 and 1 inclusive) indicating the alpha opacity of the arrow-mark fill color (0 = fully transparent, 0.5 = translucent, 1 = fully opaque).

lc

NA or a character vector containing valid color representations giving the color of lines used to draw end marks.

la

NA or a proportion vector (i.e., between 0 and 1 inclusive) indicating the alpha opacity of the lines used to draw arrow marks.

lw

NA or a positive numeric vector indicating proportional line width relative to the default giving the width of lines used to draw arrow marks.

shape

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

loc

character scalar giving the location of end marks on line segments. 's' indicates an end mark at the starts of segments, 'e' indicates an end mark at the ends of segments, 'b' indicates end marks at both ends of segments, and 'm' indicates end marks at the midpoints of segments.

which

character scalar indicating which segments in a series of x-y pairs should be given end marks. 'f' indicates the first segment only, 'l' indicates the last segment only, 'b' indicates first and last segments only and 'a' indicates all segments.

Value

pj with the addition of the end-mark look applied to the specified shape.

Valid combinations of argument properties

Intervals can be validly described using a number of patterns of argument properties as follows, where base indicates that the argument set (loc, which, size) have all been supplied, line indicates that the argument set (lc, la, lw) have all been supplied, and fill indicates that the argument set (fc, fa) have both been supplied.

base + mark = ">" + line

line-based arrowheads as end mark.

base + mark = "t" + line

empty triangle-based arrowheads as end mark.

base + mark = "t" + fill

solid triangle-based arrowheads as end mark.

base + mark = "t" + line + fill

filled and outlined triangle-based arrowheads as end mark.

base + mark = "c" + line

empty circle as end mark.

base + mark = "c" + fill

solid circle as end mark.

base + mark = "c" + line + fill

filled and outlined circle as end mark.

base + mark = "d" + line

empty diamond as end mark.

base + mark = "d" + fill

solid diamond as end mark.

base + mark = "d" + line + fill

filled and outlined diamond as end mark.

base + mark = "s" + line

empty square as end mark.

base + mark = "s" + fill

solid square as end mark.

base + mark = "s" + line + fill

filled and outlined square as end mark.

Argument recycling

The arguments mark, size, lc, la, lw, fc, and/or fa are recycled with the number of segments between x-y pairs of the shape to which the end-mark look is applied.

See Also

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


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