Sets the data points in a graphic object. The function will identify and set all ynames in the graph.

set_curves(
  g,
  target,
  ynames,
  curve_interpolation = TRUE,
  nmatch = 0L,
  matches = NULL,
  dnr = NULL,
  period = numeric(0),
  show_realized = FALSE,
  show_future = FALSE,
  clip = TRUE
)

Arguments

g

A gTree object, typically loaded by chartbox::load_chart()

target

A list with elements "psn" and "xyz", e.g. as produced by bdsreader::read_bds()

ynames

A vector with the names of the response variables for which matches are sought, e.g. ynames = c("hdc", "hgt").

curve_interpolation

A logical indicating whether curve interpolation shoud be applied.

nmatch

Integer. Number of matches needed. When nmatch == 0L no matches are sought.

matches

List of vector containing the id's of the matches in the donor data. List elements should be named after ynames. The default value (NULL) indicates that no matches are plotted.

dnr

A string with the name of the donor data (currently available are smocc, terneuzen, lollypop and pops)

period

A vector of length 2 with left and right ages (decimal age). If length(period) == 0L, then no curve matching is done

show_realized

A logical indicating whether the realized growth of the target child should be drawn

show_future

A logical indicating whether the predicted growth of the target child should be drawn

clip

A logical indicating whether clipping is needed

Value

The grid object g with data points added.