plot_polymr | R Documentation |
This function provides an easy interface to quickly visualize the results
from PolyMR using ggplot2
.
plot_polymr(
polymr_results,
show_polymr = TRUE,
show_observational = TRUE,
show_binned_observations = TRUE,
show_confidence_ribbons = TRUE,
scale_values = TRUE,
output_filename = NULL,
main_title = "Effects of exposure on outcome",
subtitle = NULL,
auto_subtitle = TRUE,
xlab = ifelse(scale_values, "Exposure (scaled)", "Exposure"),
ylab = ifelse(scale_values, "Outcome (scaled)", "Outcome"),
ylims = NULL,
show_legend = TRUE,
ggsave_options = list(width = 18, height = 18, units = "cm"),
n_points = 1000
)
polymr_results |
A list containing the results from the |
show_polymr |
Boolean indicating whether or not to plot the inferred causal function (default is TRUE). |
show_observational |
Boolean indicating whether or not to plot the
observed association. Requires the observational association to have been
estimated by the |
show_binned_observations |
Boolean indicating whether or not to plot the
binned observations, specifically the median exposure and outcome for each
bin. Requires the binned values to have been returned by the |
show_confidence_ribbons |
Boolean indicating whether or not to display the 95% confidence hulls (default is TRUE). |
scale_values |
Boolean indicating whether or not to leave phenotypes
(exposure and outcome) standardized with mean 0 and variance 1 or convert
them back to their original range using the values in
|
output_filename |
The file name of the plot to be saved, if any. This
will override any |
main_title |
Main title of the plot (default is "Effect of exposure on outcome"). |
subtitle |
Subtitle of the plot. If |
auto_subtitle |
Whether to create and include a summary of results as
subtitle. This summary includes the p-values and variance explained for the
plotted functions (total variance for the observational association,
causal variance for PolyMR). Default is |
xlab |
Label for the X axis. Default is "Exposure (scaled)" if
|
ylab |
Label for the Y axis. Default is "Outcome (scaled)" if
|
ylims |
An optional vector of length 2 defining the boundaries of the
plotted region on the Y axis. Default is NULL, relying on |
show_legend |
Whether or not to display the legend next to the plot
(default is |
ggsave_options |
A list of options to provide to |
n_points |
Number of points to plot in rendering the curve. Default is 1000, resulting in a smooth enough curve for most purposes. |
The plot is created using the gpplot2
library. The resulting
plot can be customized using the standard ggplot2
functions.
An object of the gg
and ggplot
classes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.