gap_map_plot.RdCreates a base-R evidence gap map with outcomes and interventions on the axes, bubble sizes representing number of studies, and labels inside bubbles representing number of effect sizes.
gap_map_plot(
data,
intervention,
outcome,
study_id = NULL,
effect_id = NULL,
n_studies = NULL,
n_effects = NULL,
switch_axes = FALSE,
intervention_order = NULL,
outcome_order = NULL,
bubble_range = c(1.5, 7),
bubble_col = "#2E6F95",
bubble_border = "gray20",
text_col = "white",
display_effect_labels = TRUE,
effect_label_cex = 0.9,
bubble_size_by = c("studies", "effects"),
label_value = c("effects", "studies"),
draw_mode = c("both", "bubbles_only", "labels_only"),
show_grid = TRUE,
grid_col = "gray90",
show_size_legend = TRUE,
size_legend_title = NULL,
size_legend_values = NULL,
main = "Evidence Gap Map",
xlab = NULL,
ylab = NULL,
cex_axis = 0.85,
cex_main = 1,
size_legend_position = "outside_right",
size_legend_inset = 0,
main_adj = 0.5,
main_line = NULL
)A data frame.
Character string naming the intervention column.
Character string naming the outcome column.
Optional character string naming the study ID column (for
long-format input). If omitted, n_studies must be supplied.
Optional character string naming the effect size ID column
(for long-format input). If omitted and n_effects is not supplied, each
row is treated as one effect size.
Optional character string naming a numeric column with pre-aggregated study counts per cell.
Optional character string naming a numeric column with pre-aggregated effect-size counts per cell.
Logical. If TRUE, outcomes are on the x-axis and
interventions are on the y-axis.
Optional character vector for intervention ordering.
Optional character vector for outcome ordering.
Numeric vector of length 2 with minimum and maximum point
sizes (cex) for bubbles.
Fill color for bubbles.
Border color for bubbles.
Text color for the number of effect sizes inside bubbles.
Logical. If TRUE, prints effect-size counts
inside bubbles.
Numeric scaling for effect-size labels.
Which metric controls bubble size:
"studies" (default) or "effects".
Which metric is shown as text labels:
"effects" (default) or "studies".
What to draw: "both" (bubbles + labels),
"bubbles_only", or "labels_only" (numbers without bubbles).
Logical. If TRUE, draws grid lines between cells.
Color for grid lines.
Logical. If TRUE, draws a legend for bubble size.
Title for the bubble-size legend. If NULL,
it is chosen automatically from bubble_size_by.
Optional numeric vector of study-count values used
in the size legend. If NULL, values are selected automatically.
Main title.
Optional x-axis label. If NULL, generated automatically.
Optional y-axis label. If NULL, generated automatically.
Axis label scaling.
Main title scaling.
Legend position keyword or numeric coordinates.
Use "none" to suppress the bubble-size legend. The default
"outside_right" places it outside the plotting panel.
Numeric inset passed to legend.
Horizontal title alignment in [0, 1].
Optional title line. If NULL, default is used.
Invisibly returns a list with:
Aggregated data used for plotting (intervention, outcome,
n_studies, n_effects).
Ordered x-axis levels.
Ordered y-axis levels.
The function supports both long-format input (one row per effect size) and pre-aggregated input.
gap_dat <- data.frame(
study = c("S1", "S1", "S2", "S3", "S3", "S4", "S5"),
effect = c("E1", "E2", "E3", "E4", "E5", "E6", "E7"),
intervention = c("Tutoring", "Tutoring", "Tutoring", "Coaching", "Coaching", "App", "App"),
outcome = c("Math", "Math", "Reading", "Math", "Reading", "Reading", "Math"),
stringsAsFactors = FALSE
)
gap_map_plot(
data = gap_dat,
intervention = "intervention",
outcome = "outcome",
study_id = "study",
effect_id = "effect"
)
gap_map_plot(
data = gap_dat,
intervention = "intervention",
outcome = "outcome",
study_id = "study",
effect_id = "effect",
switch_axes = TRUE
)