Title: | Create a Flexible Forest Plot |
---|---|
Description: | Create a forest plot based on the layout of the data. Confidence intervals in multiple columns by groups can be done easily. Editing the plot, inserting/adding text, applying a theme to the plot, and much more. |
Authors: | Alimu Dayimu [aut, cre] |
Maintainer: | Alimu Dayimu <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.3 |
Built: | 2024-10-09 06:01:18 UTC |
Source: | https://github.com/adayim/forestploter |
Add border to any cells at any side.
add_underline
is a wrapper of add_border
can be used to add
underline to cells.
add_border( plot, row = NULL, col = NULL, part = c("body", "header"), where = c("bottom", "left", "top", "right"), gp = gpar(lwd = 2) ) add_underline( plot, row = NULL, col = NULL, part = c("body", "header"), gp = gpar(lwd = 2) )
add_border( plot, row = NULL, col = NULL, part = c("body", "header"), where = c("bottom", "left", "top", "right"), gp = gpar(lwd = 2) ) add_underline( plot, row = NULL, col = NULL, part = c("body", "header"), gp = gpar(lwd = 2) )
plot |
A forest plot object. |
row |
A numeric value or vector indicating row number to add border. This is corresponding to the data row number. Remember to account for any text inserted. A border will be drawn to all rows if this is omitted. |
col |
A numeric value or vector indicating the columns to add border. A border will be drawn to all columns if this is omitted. |
part |
The border will be added to |
where |
Where to draw the border of the cell, possible values are
|
gp |
An object of class |
A gtable
object.
gpar
segmentsGrob
gtable_add_grob
Draw grobs in any cells.
add_grob( plot, row = NULL, col = NULL, part = c("body", "header"), order = c("top", "text", "background", "bottom"), gb_fn, ... )
add_grob( plot, row = NULL, col = NULL, part = c("body", "header"), order = c("top", "text", "background", "bottom"), gb_fn, ... )
plot |
A forest plot object. |
row |
A numeric value or vector indicating row(s) to draw a grob. |
col |
A numeric value or vector indicating the columns to draw a grob. |
part |
The border will be added to |
order |
Order in which the grobs should be plotted. Use |
gb_fn |
Grob function |
... |
Other parameters to be passed to |
A gtable
object.
This function can be used to add text to forest plot. The text can be span to multiple rows and columns. The height of the row will be changed accordingly if the text is added to only one row. The width of the text may exceeds the columns provided if the text is too long.
add_text( plot, text, row = NULL, col = NULL, part = c("body", "header"), just = c("center", "left", "right"), gp = gpar(), padding = unit(1, "mm"), parse = FALSE )
add_text( plot, text, row = NULL, col = NULL, part = c("body", "header"), just = c("center", "left", "right"), gp = gpar(), padding = unit(1, "mm"), parse = FALSE )
plot |
A forest plot object. |
text |
A character or expression vector, see |
row |
Row to add the text, this will be ignored if the |
col |
A numeric value or vector indicating the columns the text will be added. The text will span over the column if a vector is given. |
part |
Part to add text, body (default) or header. |
just |
The justification of the text, |
gp |
An object of class |
padding |
Padding of the text, default is |
parse |
Logical, behaviour for parsing text as plotmath, see
|
A gtable
object.
gtable
gpar
textGrob
gtable_add_grob
This function is used to edit the graphical parameter of text and background of the forest plot.
edit_plot( plot, row = NULL, col = NULL, part = c("body", "header"), which = c("text", "background", "ci"), gp = gpar(), ... )
edit_plot( plot, row = NULL, col = NULL, part = c("body", "header"), which = c("text", "background", "ci"), gp = gpar(), ... )
plot |
A forest plot object. |
row |
A numeric value or vector indicating row number to edit in the
dataset. Will edit the whole row if left blank for the body. This will be
ignored if the |
col |
A numeric value or vector indicating column to edit in the dataset. Will edit the whole column if left blank. |
part |
Part to edit, |
which |
Which element to edit, |
gp |
Pass |
... |
Other parameters to be passed to the grobs. For the |
A gtable
object.
gpar
editGrob
forest_theme
textGrob
rectGrob
A data frame will be used for the basic layout of the forest plot.
Graphical parameters can be set using the forest_theme
function.
forest( data, est, lower, upper, sizes = 0.4, ref_line = ifelse(x_trans %in% c("log", "log2", "log10"), 1, 0), vert_line = NULL, ci_column, is_summary = NULL, xlim = NULL, ticks_at = NULL, ticks_digits = NULL, ticks_minor = NULL, arrow_lab = NULL, x_trans = "none", xlab = NULL, footnote = NULL, title = NULL, nudge_y = 0, fn_ci = makeci, fn_summary = make_summary, index_args = NULL, theme = NULL, ... )
forest( data, est, lower, upper, sizes = 0.4, ref_line = ifelse(x_trans %in% c("log", "log2", "log10"), 1, 0), vert_line = NULL, ci_column, is_summary = NULL, xlim = NULL, ticks_at = NULL, ticks_digits = NULL, ticks_minor = NULL, arrow_lab = NULL, x_trans = "none", xlab = NULL, footnote = NULL, title = NULL, nudge_y = 0, fn_ci = makeci, fn_summary = make_summary, index_args = NULL, theme = NULL, ... )
data |
Data to be displayed in the forest plot |
est |
Point estimation. Can be a list for multiple columns
and/or multiple groups. If the length of the list is larger than
then length of |
lower |
Lower bound of the confidence interval, same as |
upper |
Upper bound of the confidence interval, same as |
sizes |
Size of the point estimation box, can be a unit, vector or a list. Values will be used as it is, no transformation will be applied. |
ref_line |
X-axis coordinates of zero line, default is 1. Provide an atomic
vector if different reference line for each |
vert_line |
Numerical vector, add additional vertical line at given value.
Provide a list of numerical vector element if different vertical line for each
|
ci_column |
Column number of the data the CI will be displayed. |
is_summary |
A logical vector indicating if the value is a summary value,
which will have a diamond shape for the estimate. Can not be used with multiple
group |
xlim |
Limits for the x axis as a vector of length 2, i.e. c(low, high). It
will take the minimum and maximum of the lower and upper value if not provided.
This will apply to all CI columns if provided, and will be calculated automatically
for each column if not provided. This should be a list with the same length of
|
ticks_at |
Set X-axis tick-marks point. This will apply to all CI columns if
provided, and will be calculated automatically for each column if not provided.
This should be a list if different |
ticks_digits |
Number of digits for the x-axis, default is |
ticks_minor |
A numeric vector of positions to draw ticks without labels (optional).
The values provided here can be superset or disjoint sets of |
arrow_lab |
Labels for the arrows, string vector of length two (left and right). The theme of arrow will inherit from the x-axis. This should be a list if different arrow labels for each column is desired. |
x_trans |
Change axis scale, Allowed values are one of c("none", "log", "log2",
"log10"). Default is |
xlab |
X-axis labels, it will be put under the x-axis. An atomic vector should
be provided if different |
footnote |
Footnote for the forest plot, will be aligned at left bottom of the plot. Please adjust the line length with line break to avoid the overlap with the arrow and/or x-axis. |
title |
The text for the title. |
nudge_y |
Horizontal adjustment to nudge groups by, must be within 0 to 1. |
fn_ci |
Name of the function to draw confidence interval, default is
|
fn_summary |
Name of the function to draw summary confidence interval,
default is |
index_args |
A character vector, name of the arguments used for indexing
the row and column. This should be the name of the arguments that is working
the same way as |
theme |
Theme of the forest plot, see |
... |
Other arguments passed on to the |
A gtable
object.
gtable
tableGrob
forest_theme
make_boxplot
makeci
make_summary
library(grid) # Read provided sample example data dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) # Keep needed columns dt <- dt[,1:6] # indent the subgroup if there is a number in the placebo column dt$Subgroup <- ifelse(is.na(dt$Placebo), dt$Subgroup, paste0(" ", dt$Subgroup)) # NA to blank or NA will be transformed to carachter. dt$Treatment <- ifelse(is.na(dt$Treatment), "", dt$Treatment) dt$Placebo <- ifelse(is.na(dt$Placebo), "", dt$Placebo) dt$se <- (log(dt$hi) - log(dt$est))/1.96 # Add blank column for the forest plot to display CI. # Adjust the column width with space. dt$` ` <- paste(rep(" ", 20), collapse = " ") # Create confidence interval column to display dt$`HR (95% CI)` <- ifelse(is.na(dt$se), "", sprintf("%.2f (%.2f to %.2f)", dt$est, dt$low, dt$hi)) # Define theme tm <- forest_theme(base_size = 10, refline_gp = gpar(col = "red"), footnote_gp = gpar(col = "#636363", fontface = "italic")) p <- forest(dt[,c(1:3, 8:9)], est = dt$est, lower = dt$low, upper = dt$hi, sizes = dt$se, ci_column = 4, ref_line = 1, arrow_lab = c("Placebo Better", "Treatment Better"), xlim = c(0, 4), ticks_at = c(0.5, 1, 2, 3), footnote = "This is the demo data. Please feel free to change\nanything you want.", theme = tm) # Print plot plot(p)
library(grid) # Read provided sample example data dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) # Keep needed columns dt <- dt[,1:6] # indent the subgroup if there is a number in the placebo column dt$Subgroup <- ifelse(is.na(dt$Placebo), dt$Subgroup, paste0(" ", dt$Subgroup)) # NA to blank or NA will be transformed to carachter. dt$Treatment <- ifelse(is.na(dt$Treatment), "", dt$Treatment) dt$Placebo <- ifelse(is.na(dt$Placebo), "", dt$Placebo) dt$se <- (log(dt$hi) - log(dt$est))/1.96 # Add blank column for the forest plot to display CI. # Adjust the column width with space. dt$` ` <- paste(rep(" ", 20), collapse = " ") # Create confidence interval column to display dt$`HR (95% CI)` <- ifelse(is.na(dt$se), "", sprintf("%.2f (%.2f to %.2f)", dt$est, dt$low, dt$hi)) # Define theme tm <- forest_theme(base_size = 10, refline_gp = gpar(col = "red"), footnote_gp = gpar(col = "#636363", fontface = "italic")) p <- forest(dt[,c(1:3, 8:9)], est = dt$est, lower = dt$low, upper = dt$hi, sizes = dt$se, ci_column = 4, ref_line = 1, arrow_lab = c("Placebo Better", "Treatment Better"), xlim = c(0, 4), ticks_at = c(0.5, 1, 2, 3), footnote = "This is the demo data. Please feel free to change\nanything you want.", theme = tm) # Print plot plot(p)
Default theme for the forest plot, but can pass other parameters. The parameters will be passed to corresponding elements of the forest plot.
ci_*
Control the graphical parameters of confidence intervals
legend_*
Control the graphical parameters of legend
xaxis_*
Control the graphical parameters of x-axis
refline_*
Control the graphical parameters of reference line
vertline_*
Control the graphical parameters of vertical line
summary_*
Control the graphical parameters of diamond shaped summary CI
footnote_*
Control the graphical parameters of footnote
title_*
Control the graphical parameters of title
arrow_*
Control the graphical parameters of arrow
See gpar
for more details.
forest_theme( base_size = 12, base_family = "", ci_pch = 15, ci_col = "black", ci_alpha = 1, ci_fill = NULL, ci_lty = 1, ci_lwd = 1, ci_Theight = NULL, legend_name = "Group", legend_position = "right", legend_value = "", legend_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 1), xaxis_gp = gpar(fontsize = base_size, fontfamily = base_family, lwd = 0.6, cex = 1), refline_gp = gpar(lwd = 1, lty = "dashed", col = "grey20"), vertline_lwd = 1, vertline_lty = "dashed", vertline_col = "grey20", summary_col = "#4575b4", summary_fill = summary_col, footnote_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 0.6, fontface = "plain", col = "black"), footnote_parse = TRUE, title_just = c("left", "right", "center"), title_gp = gpar(cex = 1.2, fontface = "bold", col = "black", fontfamily = base_family), arrow_type = c("open", "closed"), arrow_label_just = c("start", "end"), arrow_length = 0.05, arrow_gp = gpar(fontsize = base_size, fontfamily = base_family, lwd = 0.6), xlab_adjust = c("refline", "center"), xlab_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 1, fontface = "plain"), ... )
forest_theme( base_size = 12, base_family = "", ci_pch = 15, ci_col = "black", ci_alpha = 1, ci_fill = NULL, ci_lty = 1, ci_lwd = 1, ci_Theight = NULL, legend_name = "Group", legend_position = "right", legend_value = "", legend_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 1), xaxis_gp = gpar(fontsize = base_size, fontfamily = base_family, lwd = 0.6, cex = 1), refline_gp = gpar(lwd = 1, lty = "dashed", col = "grey20"), vertline_lwd = 1, vertline_lty = "dashed", vertline_col = "grey20", summary_col = "#4575b4", summary_fill = summary_col, footnote_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 0.6, fontface = "plain", col = "black"), footnote_parse = TRUE, title_just = c("left", "right", "center"), title_gp = gpar(cex = 1.2, fontface = "bold", col = "black", fontfamily = base_family), arrow_type = c("open", "closed"), arrow_label_just = c("start", "end"), arrow_length = 0.05, arrow_gp = gpar(fontsize = base_size, fontfamily = base_family, lwd = 0.6), xlab_adjust = c("refline", "center"), xlab_gp = gpar(fontsize = base_size, fontfamily = base_family, cex = 1, fontface = "plain"), ... )
base_size |
The size of text |
base_family |
The font family |
ci_pch |
Shape of the point estimation. It will be reused if the forest plot is grouped. |
ci_col |
Color of the CI. A vector of color should be provided for the grouped forest plot. An internal color set will be if only not. |
ci_alpha |
Scalar value, alpha channel for transparency of point estimation. A small vertical line will be added to indicate the point estimation if this is not equals to 1. |
ci_fill |
Color fill the point estimation. A vector of color should be
provided for the grouped forest plot. If this is |
ci_lty |
Line type of the CI. A vector of line type should be provided for the grouped forest plot. |
ci_lwd |
Line width of the CI. A vector of line type should be provided for the grouped forest plot. |
ci_Theight |
A unit specifying the height of the T end of CI. If set to
|
legend_name |
Title of the legend. |
legend_position |
Position of the legend, |
legend_value |
Legend labels (expressions). A vector should be provided for the grouped forest plot. A "Group 1" etc will be created if not a vector for a grouped forest plot. |
legend_gp |
|
xaxis_gp |
|
refline_gp |
|
vertline_lwd |
Line width for extra vertical line. A vector can be provided for each vertical line, and the values will be recycled if no enough values are given. |
vertline_lty |
Line type for extra vertical line. Works same as |
vertline_col |
Line color for the extra vertical line. Works same as |
summary_col |
Color for borders of the summary diamond shape. |
summary_fill |
Color for filling the summary diamond shape. |
footnote_gp |
|
footnote_parse |
Parse footnote text (default). |
title_just |
The justification of the title, default is |
title_gp |
|
arrow_type |
Type of the arrow below x-axis, see |
arrow_label_just |
The justification of the arrow label relative to arrow. Control
the arrow label to align to the starting point of the arrow |
arrow_length |
The length of the arrow head, default is |
arrow_gp |
|
xlab_adjust |
Control the alignment of xlab to reference line (default) or center of the x-axis. |
xlab_gp |
|
... |
Other parameters passed to table. See |
A list.
tableGrob
forest
textGrob
gpar
arrow
segmentsGrob
linesGrob
pointsGrob
legendGrob
get_wh
can be used to find the correct width and height of the forestplot
for saving, as the width and height is difficult to fit for saving.
get_wh(plot, unit = c("in", "cm", "mm"))
get_wh(plot, unit = c("in", "cm", "mm"))
plot |
A forest plot object. |
unit |
Unit of the plot size in |
A named vector of width and height
## Not run: dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) dt <- dt[1:6,1:6] dt$` ` <- paste(rep(" ", 20), collapse = " ") p <- forest(dt[,c(1:3, 7)], est = dt$est, lower = dt$low, upper = dt$hi, ci_column = 4) # get_wh example p_wh <- get_wh(p) pdf('test.pdf',width = p_wh[1], height = p_wh[2]) plot(p) dev.off() ## End(Not run)
## Not run: dt <- read.csv(system.file("extdata", "example_data.csv", package = "forestploter")) dt <- dt[1:6,1:6] dt$` ` <- paste(rep(" ", 20), collapse = " ") p <- forest(dt[,c(1:3, 7)], est = dt$est, lower = dt$low, upper = dt$hi, ci_column = 4) # get_wh example p_wh <- get_wh(p) pdf('test.pdf',width = p_wh[1], height = p_wh[2]) plot(p) dev.off() ## End(Not run)
This function can be used to insert text to forest plot. Remember to adjust for the row number if you have added text before, including header. This is achieved by inserted new row(s) to the plot and will affect the row number. A text vector can be inserted to multiple columns or rows.
insert_text( plot, text, row = NULL, col = NULL, part = c("body", "header"), just = c("center", "left", "right"), before = TRUE, gp = gpar(), padding = unit(1, "mm"), parse = FALSE )
insert_text( plot, text, row = NULL, col = NULL, part = c("body", "header"), just = c("center", "left", "right"), before = TRUE, gp = gpar(), padding = unit(1, "mm"), parse = FALSE )
plot |
A forest plot object. |
text |
A character or expression vector, see |
row |
Row to insert the text, this will be ignored if the |
col |
A numeric value or vector indicating the columns the text will be added. The text will span over the column if a vector is given. |
part |
Part to insert text, body (default) or header. |
just |
The justification of the text, |
before |
Indicating the text will be inserted before or after the row. |
gp |
An object of class |
padding |
Padding of the text, default is |
parse |
Logical, behaviour for parsing text as plotmath, see
|
A gtable
object.
Create horizontal boxplot grob
make_boxplot( est, lower, upper, lowhinge, uphinge, hinge_height = 0.2, pch, sizes = 1, gp = gpar(), gp_box = gp, t_height = NULL, xlim = c(0, 1), nudge_y = 0 )
make_boxplot( est, lower, upper, lowhinge, uphinge, hinge_height = 0.2, pch, sizes = 1, gp = gpar(), gp_box = gp, t_height = NULL, xlim = c(0, 1), nudge_y = 0 )
est |
Median value. |
lower |
Lower whisker. |
upper |
Upper whisker. |
lowhinge |
Lower hinge, a standard whisker will be drawn if this is missing. |
uphinge |
Upper hinge, a standard whisker will be drawn if this is missing. |
hinge_height |
Height of the hinge, default is 0.2. |
pch |
Numeric or character vector indicating what sort of plotting
symbol to use. See |
sizes |
Size of the point estimation box, can be a unit, vector or a list. Values will be used as it is, no transformation will be applied. |
gp |
Graphical parameters of |
gp_box |
Graphical parameters passed to the hinge, this will be
passed to |
t_height |
Height of the whisker end vertices. If value is |
xlim |
Limits for the x axis as a vector of length 2, i.e. c(low, high). |
nudge_y |
Horizontal adjustment to nudge groups by, must be within 0 to 1. |
A gTree object
pointsGrob
gpar
rectGrob
linesGrob
segmentsGrob
library(grid) # Function to calculate Box plot values box_func <- function(x){ iqr <- IQR(x) q3 <- quantile(x, probs = c(0.25, 0.5, 0.75), names = FALSE) c("min" = q3[1] - 1.5*iqr, "q1" = q3[1], "med" = q3[2], "q3" = q3[3], "max" = q3[3] + 1.5*iqr) } # Prepare data val <- split(ToothGrowth$len, list(ToothGrowth$supp, ToothGrowth$dose)) val <- lapply(val, box_func) dat <- do.call(rbind, val) dat <- data.frame(Dose = row.names(dat), dat, row.names = NULL) dat$Box <- paste(rep(" ", 20), collapse = " ") # Draw single group box plot tm <- forest_theme(ci_Theight = 0.2) p <- forest(dat[,c(1, 7)], est = dat$med, lower = dat$min, upper = dat$max, # sizes = sizes, fn_ci = make_boxplot, ci_column = 2, lowhinge = dat$q1, uphinge = dat$q3, hinge_height = 0.2, index_args = c("lowhinge", "uphinge"), gp_box = gpar(fill = "black", alpha = 0.4), theme = tm ) p # Multiple group # Prepare data dat_oj <- dat[c(1, 3, 5),] dat_vc <- dat[c(2, 4, 6), ] dat <- data.frame(Dose = c(0.5, 1, 2)) dat$Box <- paste(rep(" ", 20), collapse = " ") # Draw plot tm <- forest_theme(ci_Theight = 0.2, ci_pch = 3) p <- forest(dat, est = list(dat_oj$med, dat_vc$med), lower = list(dat_oj$min, dat_vc$min), upper = list(dat_oj$max, dat_vc$max), fn_ci = make_boxplot, ci_column = 2, lowhinge = list(dat_oj$q1, dat_vc$q1), uphinge = list(dat_oj$q3, dat_vc$q3), hinge_height = 0.2, index_args = c("lowhinge", "uphinge"), theme = tm ) p
library(grid) # Function to calculate Box plot values box_func <- function(x){ iqr <- IQR(x) q3 <- quantile(x, probs = c(0.25, 0.5, 0.75), names = FALSE) c("min" = q3[1] - 1.5*iqr, "q1" = q3[1], "med" = q3[2], "q3" = q3[3], "max" = q3[3] + 1.5*iqr) } # Prepare data val <- split(ToothGrowth$len, list(ToothGrowth$supp, ToothGrowth$dose)) val <- lapply(val, box_func) dat <- do.call(rbind, val) dat <- data.frame(Dose = row.names(dat), dat, row.names = NULL) dat$Box <- paste(rep(" ", 20), collapse = " ") # Draw single group box plot tm <- forest_theme(ci_Theight = 0.2) p <- forest(dat[,c(1, 7)], est = dat$med, lower = dat$min, upper = dat$max, # sizes = sizes, fn_ci = make_boxplot, ci_column = 2, lowhinge = dat$q1, uphinge = dat$q3, hinge_height = 0.2, index_args = c("lowhinge", "uphinge"), gp_box = gpar(fill = "black", alpha = 0.4), theme = tm ) p # Multiple group # Prepare data dat_oj <- dat[c(1, 3, 5),] dat_vc <- dat[c(2, 4, 6), ] dat <- data.frame(Dose = c(0.5, 1, 2)) dat$Box <- paste(rep(" ", 20), collapse = " ") # Draw plot tm <- forest_theme(ci_Theight = 0.2, ci_pch = 3) p <- forest(dat, est = list(dat_oj$med, dat_vc$med), lower = list(dat_oj$min, dat_vc$min), upper = list(dat_oj$max, dat_vc$max), fn_ci = make_boxplot, ci_column = 2, lowhinge = list(dat_oj$q1, dat_vc$q1), uphinge = list(dat_oj$q3, dat_vc$q3), hinge_height = 0.2, index_args = c("lowhinge", "uphinge"), theme = tm ) p
Create pooled summary diamond shape
make_summary(est, lower, upper, sizes = 1, gp, xlim, nudge_y = NULL)
make_summary(est, lower, upper, sizes = 1, gp, xlim, nudge_y = NULL)
est |
Point estimation. Can be a list for multiple columns
and/or multiple groups. If the length of the list is larger than
then length of |
lower |
Lower bound of the confidence interval, same as |
upper |
Upper bound of the confidence interval, same as |
sizes |
Size of the point estimation box, can be a unit, vector or a list. Values will be used as it is, no transformation will be applied. |
gp |
Graphical parameters of |
xlim |
Limits for the x axis as a vector of length 2, i.e. c(low, high). It
will take the minimum and maximum of the lower and upper value if not provided.
This will apply to all CI columns if provided, and will be calculated automatically
for each column if not provided. This should be a list with the same length of
|
nudge_y |
Horizontal adjustment to nudge groups by, must be within 0 to 1. |
A gTree object
Create confidence interval grob
makeci( est, lower, upper, pch, sizes = 1, gp = gpar(), t_height = NULL, xlim = c(0, 1), nudge_y = 0, name = NULL )
makeci( est, lower, upper, pch, sizes = 1, gp = gpar(), t_height = NULL, xlim = c(0, 1), nudge_y = 0, name = NULL )
est |
Point estimation. Can be a list for multiple columns
and/or multiple groups. If the length of the list is larger than
then length of |
lower |
Lower bound of the confidence interval, same as |
upper |
Upper bound of the confidence interval, same as |
pch |
Numeric or character vector indicating what sort of plotting
symbol to use. See |
sizes |
Size of the point estimation box, can be a unit, vector or a list. Values will be used as it is, no transformation will be applied. |
gp |
Graphical parameters of |
t_height |
The height confidence interval line end vertices. If
value is |
xlim |
Limits for the x axis as a vector of length 2, i.e. c(low, high). It
will take the minimum and maximum of the lower and upper value if not provided.
This will apply to all CI columns if provided, and will be calculated automatically
for each column if not provided. This should be a list with the same length of
|
nudge_y |
Horizontal adjustment to nudge groups by, must be within 0 to 1. |
name |
name of the grob. |
A gTree object
Print or draw forestplot.
## S3 method for class 'forestplot' print(x, autofit = FALSE, ...) ## S3 method for class 'forestplot' plot(x, autofit = FALSE, ...)
## S3 method for class 'forestplot' print(x, autofit = FALSE, ...) ## S3 method for class 'forestplot' plot(x, autofit = FALSE, ...)
x |
forestplot to display |
autofit |
If true, the plot will be autofit. |
... |
other arguments not used by this method |
Invisibly returns the original forestplot.