pkgdown/extra-head.html

Skip to contents

Plot IC scores and the running best IC across a stored bifrost search trajectory.

Usage

# S3 method for class 'icTrajectory'
plot(
  x,
  main = "IC Trajectory",
  show_delta = "overlay",
  ic_limits = NULL,
  delta_limits = NULL,
  xlab = "Search step",
  ylab = NULL,
  symbols = NULL,
  scales = NULL,
  point_sizes = NULL,
  line_widths = NULL,
  text_sizes = NULL,
  annotation = NULL,
  legend = TRUE,
  ...
)

Arguments

x

An icTrajectory object.

main

Plot title.

show_delta

One of "overlay", "panel", or "none". The default "overlay" draws proposal delta_ic values on a secondary y-axis. "panel" draws them in a lower panel. Logical values are accepted for compatibility: TRUE maps to "overlay" and FALSE maps to "none".

ic_limits

Optional numeric vector of length 2 giving y-limits for the primary IC axis.

delta_limits

Optional numeric vector of length 2 giving y-limits for the delta_ic panel or secondary axis. The order is preserved, so c(high, low) reverses the axis and draws positive delta_ic values downward.

xlab, ylab

Axis labels.

symbols

Optional named vector or list of point symbols. Valid names are accepted, rejected, error, baseline, and delta.

scales

Optional named numeric vector or list of global scale multipliers. Valid names are point, line, and text.

point_sizes

Optional named numeric vector or list of point sizes. Valid names are accepted, rejected, error, baseline, and delta.

line_widths

Optional named numeric vector or list of line widths. Valid names are accepted, rejected, error, running_best, delta, and zero.

text_sizes

Optional named numeric vector or list of text sizes. Valid names are main, axis, x_axis, y_axis, delta_axis, axis_label, annotation, and legend.

annotation

Optional named numeric vector or list of annotation settings. Currently supports baseline_label_offset, the text offset for the baseline IC annotation passed to graphics::text() when pos = 4.

legend

Legend controls. Use TRUE or FALSE to show or hide the legend, or provide a named list with any of show, position, inset, bty, and labels. position, inset, bty, and labels are passed to graphics::legend() after validation. The default delta legend label is rendered as \(\Delta IC\).

...

Unused; included for S3 compatibility.

Value

Invisibly returns x.

Examples

search <- list(
  baseline_ic = -1000,
  IC_used = "GIC",
  model_fit_history = list(
    fits = list(
      list(
        step = 1, candidate_node = 42, regime_id = "1",
        ic = -1010, accepted = TRUE, delta_ic = 10
      ),
      list(
        step = 2, candidate_node = 57, regime_id = "2",
        ic = -1008, accepted = FALSE, delta_ic = -2
      )
    )
  )
)
class(search) <- c("bifrost_search", "list")
traj <- icTrajectory(search)

plot(traj)

plot(
  traj,
  delta_limits = c(15, -5),
  scales = c(point = 1.2, line = 1.1),
  point_sizes = c(rejected = 0.7),
  legend = list(position = "bottomleft")
)