Low-level function. Sets specific theme elements of an scplot object.

set_theme_element(object, ...)

Arguments

object

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

...

various style parameters for specific theme elements (see Details).

Value

An object of class scplot (seescplot()) with a changed theme element. If no arguments are provided, the possible theme elements are printed.

Details

Allows customization of individual theme elements by passing them as named arguments.

Usually, you don't need this function. Possible theme elements are: "text", "plot.background", "panel.background", "panel.spacing.y", "dataline", "datapoint", "statline", "axis.expand.x", "axis.expand.y", "axis.line.x", "axis.line.y", "axis.ticks.length", "axis.ticks", "axis.title.y", "axis.title.x", "axis.text.x", "axis.text.y", "plot.title", "plot.caption", "plot.margin", "casenames", "casenames.strip", "casenames.background", "casenames.position", "phasenames", "phasenames.position.x", "separators", "separators.extent", "label.text", "label.background", "label.padding", "grid", "legend.position", "legend.background", "legend.text", "legend.title", "legend.margin".

The elements are of the following classes:

  • text = c("element_text", "element"),

  • plot.background = c("element_rect", "element"),

  • panel.spacing.y = c("simpleUnit", "unit", "unit_v2"),

  • dataline = "list",

  • datapoint = "list",

  • statline = c("element_line", "element" ),

  • axis.expand.x = "numeric",

  • axis.expand.y = "numeric",

  • axis.line.x = c("element_line", "element"),

  • axis.line.y = c("element_line", "element"),

  • axis.ticks.length = c("simpleUnit", "unit", "unit_v2"),

  • axis.ticks = c("element_line", "element"),

  • axis.title.y = c("element_text", "element"),

  • axis.title.x = c("element_text", "element"),

  • axis.text.x = c("element_text", "element"),

  • axis.text.y = c("element_text", "element"),

  • plot.title = c("element_text", "element"),

  • plot.caption = c("element_text", "element"),

  • plot.margin = c("margin", "simpleUnit", "unit","unit_v2"),

  • casenames = c("element_text", "element"),

  • casenames.strip = c("element_rect", "element"),

  • casenames.background = c("element_rect", "element"),

  • casenames.position = "character",

  • phasenames = c("element_text", "element"),

  • phasenames.position.x = "character",

  • separators = c("element_line", "element"),

  • separators.extent = "character",

  • label.text = c("element_text", "element"),

  • label.background = c("element_rect", "element" ),

  • label.padding = "numeric", grid = c("element_line", "element" ),

  • legend.position = "character",

  • legend.background = c("element_rect", "element"),

  • legend.text = c("element_text", "element"),

  • legend.title = c("element_text", "element"),

  • legend.margin = c("margin", "simpleUnit", "unit", "unit_v2")

Examples

data(exampleABC, package = "scan")
p1 <- scplot(exampleABC)  |>
  set_theme_element(
    axis.ticks.length = unit(0, "points"),
    axis.line.y = element_line(color = "darkred", linewidth = 2),
    panel.background = element_rect(color = "darkblue", linewidth = 1),
    panel.spacing.y = unit(0, "points"),
    phasenames = element_text(color = "#00000000")
  )