Produces a ggplot2 forest plot from the output of herit_batch() or a
list of herit_vc() results coerced to a data frame.
plot_forest(
results,
model_filter = NULL,
colour_by = "trait",
sig_threshold = 0.05,
title = NULL,
x_limits = c(0, 1)
)Data frame as returned by herit_batch(), containing at
least columns label, trait, h2, ci_lo, ci_hi, pval.
Optional character vector of model name substrings to
keep (matched against label). E.g. "cov2" to show only the
age + sex + age-squared model.
Column to colour points by. Default "trait". Set to
NULL for a monochrome plot.
Numeric. Traits with pval below this threshold are
shown with a filled point; others with an open point. Default 0.05.
Optional plot title string.
Numeric vector of length 2 for the x-axis range.
Default c(0, 1).
A ggplot2::ggplot object. Colours follow the itable_colours
palette by default (pink #FE9EC7 and blue #44ACFF as the primary pair).
Requires ggplot2 (listed in Suggests). An informative error is thrown
if it is not installed.
if (FALSE) { # \dontrun{
res <- herit_batch(c("bmi", "hdl", "systolic_bp"),
grm = A, data = my_data,
covs_list = list(unadj = NULL,
cov2 = c("age", "sex", "age2")))
plot_forest(res, model_filter = "cov2", title = "Adjusted heritability")
} # }