View source: R/added_plotting_functions.R
| plot_interaction_surface | R Documentation |
Visualizes a metric (e.g., conditional Bayesian power) as a function of two effect grid variables for a fixed sample size or averaged over n. Allows line, heatmap, or contour modes.
plot_interaction_surface(
data,
metric,
effect1,
effect2,
n = NULL,
line = FALSE,
facet_by = NULL,
agg_fun = mean,
title = NULL,
subtitle = NULL
)
data |
Data frame (typically power_results$summary). |
metric |
Name of the summary column to plot, e.g. "power_direction", "power_threshold". |
effect1 |
Name of effect grid column for x-axis. |
effect2 |
Name of effect grid column for y-axis or color/facets. |
n |
Optional sample size to filter to (else averages/plots all n's). |
line |
Logical; if TRUE, make a lineplot (effect1 on x, one line for each effect2). If FALSE, make a heatmap or contour. |
facet_by |
Optional grid column(s) to facet by. |
agg_fun |
Aggregation function if multiple entries per cell (default = mean). |
title, subtitle |
Optional plot labels. |
A ggplot object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.