This function adds value labels to an existing scplot object. The labels display the values of a specified variable (default is .dvar, which typically represents the main variable being plotted). You can customize the position, rounding, text style, and background style of the labels.

add_labels(
  object,
  nudge_y = 5,
  nudge_x = 0,
  round = NULL,
  text = list(),
  background = list(),
  variable = ".dvar",
  padding = NULL
)

Arguments

object

An scplot object (class scplot) returned from the scplot() function.

nudge_y

Offset on the y-axis.

nudge_x

Offset on the x-axis.

round

Number of digits of the labels. If NULL, no rounding is applied.

text

List with text parameters ("family", "face", "colour", "size", "hjust", "vjust", "angle", "lineheight", "margin"). See element_text().

background

A list with background styling arguments (fill, color, size, linetype).

variable

Name of the dataline variable to apply the style.

padding

Padding size around text.

Value

An object of class scplot (seescplot()) with added/changed element labels.