plot.event_model: Plot an event_model object

View source: R/event_model.R

plot.event_modelR Documentation

Plot an event_model object

Description

Creates a detailed plot of an event_model object by visualizing its design matrix. The design matrix is first converted into a long-format tibble and then plotted over time, with separate panels for each block. Several customization options are available.

Usage

## S3 method for class 'event_model'
plot(
  x,
  y,
  term_name = NULL,
  longnames = TRUE,
  title = NULL,
  xlab = "Time",
  ylab = "Value",
  line_size = 1,
  color_palette = "Set1",
  facet_ncol = 1,
  theme_custom = ggplot2::theme_bw(base_size = 14),
  hide_legend_threshold = 25,
  ...
)

Arguments

x

An event_model object.

y

Unused.

term_name

Optional: Name of the term to plot. If NULL, the first term is plotted.

longnames

Logical flag; if TRUE, use long condition names; if FALSE, use short names. Default is TRUE.

title

Optional title for the plot. If not provided, a default title is generated.

xlab

Label for the x-axis. Default is "Time".

ylab

Label for the y-axis. Default is "Value".

line_size

Numeric value for the line thickness in the plot. Default is 1.

color_palette

The name of a ColorBrewer palette to use. Default is "Set1".

facet_ncol

Number of columns for facet_wrap. Default is 1.

theme_custom

A ggplot2 theme to apply. Default is theme_bw with base_size 14.

hide_legend_threshold

If the number of unique conditions exceeds this threshold, the legend is hidden. Default is 25.

...

Additional arguments passed to ggplot2::geom_line().

Value

A ggplot2 plot object.


bbuchsbaum/fmrireg documentation built on March 1, 2025, 11:20 a.m.