get_wh: Get widths and height the forestplot

View source: R/helper.R

get_whR Documentation

Get widths and height the forestplot

Description

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.

Usage

get_wh(plot, unit = c("in", "cm", "mm"))

Arguments

plot

A forest plot object.

unit

Unit of the plot size in units ("in", "cm", or "mm")to be saved.

Value

A named vector of width and height

Examples

## 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)

forestploter documentation built on May 29, 2024, 5:48 a.m.