showplot: Display MR Plots on Screen

showplotR Documentation

Display MR Plots on Screen

Description

Renders plots stored in an MRScatterPlots, GWASForestPlots, or MRForestPlots object to the active graphics device. You can display all plots or filter to a specific outcome, exposure, or outcome-exposure pair.

Usage

showplot(object, outcome = NULL, exposure = NULL)

Arguments

object

An MRScatterPlots, GWASForestPlots, or MRForestPlots object.

outcome

Optional character string; if supplied, only plots whose outcome matches this value are displayed.

exposure

Optional character string; if supplied, only plots whose exposure matches this value are displayed.

Details

Filtering logic:

  • Both outcome and exposure supplied — displays the single plot for that exact pair.

  • outcome only — displays all exposures for that outcome.

  • exposure only — displays all outcomes for that exposure.

  • Neither supplied — displays every plot in the object.

Value

Invisibly returns object.

Examples


data("fi_49item")
input1   <- harmonize_mr_data(df = fi_49item)$input_df
outcome1 <- run_mr_analysis(MR_input_data = input1)

# Scatter plots
scatter <- plot_mr_scatter(MR_input_data = input1, summary_df = outcome1)
showplot(scatter)
showplot(scatter, outcome = "fi_49item")
showplot(scatter, outcome = "fi_49item", exposure = "Zn")

# GWAS forest plots
gwas_plots <- GWAS_forest(MR_input_data = input1, report_form = "Beta")
showplot(gwas_plots)
showplot(gwas_plots, exposure = "Zn")

# MR forest plots
mr_plots <- MR_forest(summary_df = outcome1, effect = "Beta")
showplot(mr_plots)
showplot(mr_plots, outcome = "fi_49item", exposure = "Zn")


autoMR documentation built on June 12, 2026, 9:07 a.m.

Related to showplot in autoMR...