Draw a forest-style plot from a fitted gtregression object produced by
functions such as uni_reg(), multi_reg(), cox_reg(), or
surv_reg(). Stratified regression outputs are displayed as one
faceted quick-view plot; use forest_df() and forest_reg() for
publication-style stratified forest tables.
Usage
plot_reg(
tbl,
title = NULL,
caption = NULL,
ref_line = NULL,
order_y = NULL,
log_x = FALSE,
xlim = NULL,
breaks = NULL,
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",
alpha = 0.05,
show_adjustment_note = TRUE
)Arguments
- tbl
A fitted
gtregressionobject.- title
Optional plot title.
- caption
Optional plot caption. If
NULL, notes are added automatically for adjustedmulti_reg()objects and displayed reference categories.- ref_line
Optional numeric value for the reference line. Defaults to 0 for linear models and 1 otherwise.
- order_y
Optional character vector specifying exposure order.
- log_x
Logical. If
TRUE, use a log-scaled x-axis for ratio measures. The defaultFALSEuses a linear x-axis.- xlim
Optional numeric vector of length 2 specifying x-axis limits.
- breaks
Optional numeric vector of x-axis tick breaks.
- point_color
Fill color for non-significant estimate points.
- errorbar_color
Color for non-significant confidence intervals.
- 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. The default is designed for a clear report or slide figure; increase it for a single large plot.
- show_ref
Logical or
NULL. The defaultNULLinherits the reference-row choice used to createtbl. IfTRUE, reference rows are shown. IfFALSE, binary exposures are shown as compact rows for the estimated non-reference category; affirmative levels such asYesor1are displayed using the variable name.- sig_color
Optional fill color for significant points.
- sig_errorbar_color
Optional color for significant error bars.
- alpha
Significance level for linear models when
p.valueis available.- show_adjustment_note
Logical; if
TRUE, add a default caption describingadjust_forvariables when available.