add_line: Adds a line to a whiteboard object

Description Usage Arguments

View source: R/whiteboard_primals.R

Description

This function adds a line (not necessarily straight) to a whiteboard object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
add_line(
  wb,
  name = NULL,
  fun = function(x) x,
  nstage = 1,
  domain = NULL,
  df = NULL,
  label = "right",
  labelopts = list(size = 18/ggplot2::.pt),
  ggopts = list(color = "#0066cc", size = 2)
)

Arguments

wb

A whiteboard object.

name

The name of the line to be used in labeling it on the whiteboard and referring to it when adding new elements.

nstage

For animated whiteboards, which stage should be added to?

domain

A numeric vector giving the full set of points on the x-axis to be evaluated in formulas. Defaults to the domain given for the existing board.

df

If preferred, instead of name, function, domain, range you can provide a two-column data.frame, where the first column x gives the x-axis values, and the second column, given the name of the line, contains the y-axis values.

label

Set to '' to draw only the line by itself. Set to 'left', 'right', or 'both' to put the name of the line near the first, last, or both points of the line.

labelopts

A list of aesthetic values to be passed to ggplot2::annotate when adding the label. Note you can include a label option in here and use a different label than name on the line. Set font size by setting the size argument, dividing your desired font size by ggplot2::.pt.

ggopts

List of aesthetic values to be passed on to ggplot2::geom_line, such as color, size, or linetype.

function

A function that takes a single input and produces a single output, describing the line to be drawn.


NickCH-K/ggwhiteboard documentation built on June 23, 2020, 11:23 p.m.