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,
xlim = NULL,
ylim = NULL,
...
)A `gridExtra` plot object or a single `ggplot` object.
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 `~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). 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 regular 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 the 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 numeric vector of length 2 for the x-axis limits.
A numeric vector of length 2 for the y-axis limits.
Additional arguments passed to `geom_point()`.