Skip to contents

Creates two aligned forest plots from compatible gtregression regression objects such as crude and adjusted outputs from uni_reg(), multi_reg(), cox_reg(), or surv_reg().

Usage

plot_reg_combine(
  tbl_uni,
  tbl_multi,
  title_uni = NULL,
  title_multi = NULL,
  caption = NULL,
  ref_line = NULL,
  order_y = NULL,
  log_x = FALSE,
  point_color = "#6B7280",
  errorbar_color = "#6B7280",
  point_size = 2.8,
  point_stroke = 0.55,
  ci_linewidth = 0.55,
  base_size = 12,
  show_ref = NULL,
  sig_color = "#0072B2",
  sig_errorbar_color = "#0072B2",
  xlim_uni = NULL,
  breaks_uni = NULL,
  xlim_multi = NULL,
  breaks_multi = NULL,
  alpha = 0.05,
  show_adjustment_note = TRUE
)

Arguments

tbl_uni

A univariate gtregression object.

tbl_multi

A multivariable gtregression object.

title_uni, title_multi

Optional panel titles.

caption

Optional combined plot caption. If NULL, notes are added automatically for adjusted multi_reg() objects and displayed reference categories.

ref_line

Optional numeric reference line. If NULL, uses 0 for linear models and 1 otherwise.

order_y

Optional character vector to customize exposure ordering.

log_x

Logical. If TRUE, use a log-scaled x-axis for ratio measures. The default FALSE uses a linear x-axis.

point_color, errorbar_color

Base colors for non-significant rows.

point_size

Diameter of estimate points in millimetres.

point_stroke

Outline width of estimate points.

ci_linewidth

Line width of confidence intervals.

base_size

Base font size for the plot theme.

show_ref

Logical or NULL. The default NULL inherits the setting used to create the supplied tables. If TRUE, include reference levels as (Ref.). If FALSE, binary exposures are shown as compact rows for the estimated non-reference category; affirmative levels such as Yes or 1 are displayed using the variable name.

sig_color, sig_errorbar_color

Optional colors for significant rows. If NULL, base colors are reused.

xlim_uni, breaks_uni

Optional x-axis limits and breaks for the univariate panel.

xlim_multi, breaks_multi

Optional x-axis limits and breaks for the multivariable panel.

alpha

Significance level for linear models when p.value is available.

show_adjustment_note

Logical; if TRUE, add a default caption describing adjust_for variables from tbl_multi when available.

Value

A patchwork object with two ggplot2 panels.