This function plots the treatment effect (TE) against specified covariates or creates a forest plot of treatment effects, arranging up to four plots in a grid.
plot_data(
data,
formula = ~1,
group = NULL,
group.colors = NULL,
study.label = NULL,
x.lab = NULL,
y.lab = "TE",
title.plot = NULL,
errbar.width = 0.25,
label.size = 6,
forest.color = "blue",
forest.shape = 19,
forest.size = 3,
forest.group = NULL,
forest.group.colors = NULL,
xlim = NULL,
ylim = NULL
)A `ggplot` object for a single plot or a `gridExtra` grob when multiple covariate plots are arranged in a grid.
A data frame with columns `TE`, `seTE`, and the covariates.
A one-sided formula (e.g., `~ x1 + x2`) for the x-axis variables. If not provided or set to `~1`, a forest plot is generated.
A character string specifying the name of the column in `data` to use for grouping the points (e.g., by color/fill) in covariate plots. Defaults to `NULL`. This parameter is ignored for forest plots.
A character vector specifying colors for the groups when `group` is used in covariate plots. Can be a named vector where names match the levels of the grouping variable. Defaults to `NULL`, which uses ggplot2's default discrete colors.
A character string specifying the name of the column in `data` that contains the study labels for the forest plot. If `NULL`, default labels ("Study 1", "Study 2", etc.) are created.
A character vector for x-axis labels. Defaults to variable names.
Text for the y-axis label. Defaults to "TE" or "Study" for forest plots.
Text for the plot title. Defaults to `NULL`.
The width of the error bars for covariate plots. Defaults to `0.25`.
A numeric value for the font size of the study labels in the forest plot. Defaults to `6`.
The color of the points and error bars in a classic (ungrouped) forest plot. Defaults to `"blue"`.
The shape of the points in the forest plot. Defaults to `19` (filled circle).
The size of the points in the forest plot. Defaults to `3`.
A character string specifying the name of a column in `data` used to group and color studies in the forest plot (`formula = ~1`). If `NULL`, a single-color forest plot is produced.
A character vector specifying colors for forest plot groups when `forest.group` is used. Can be a named vector matching group levels. If `NULL`, colors are assigned automatically: two groups use blue and red; three or more groups use a Brewer palette.
A numeric vector of length 2 specifying x-axis limits.
A numeric vector of length 2 specifying y-axis limits.
In forest plot mode (`formula = ~1`), studies can optionally be colored by a grouping variable using `forest.group`.