Point estimates with confidence intervals down a category axis, with a dashed no-effect reference line — the standard display for hazard/odds ratios, subgroup analyses, and meta-analyses. Marker area encodes study weight when size is mapped.

geom_forest(
  mapping = NULL,
  data = NULL,
  ref = 1,
  color = NULL,
  linewidth = NULL
)

Arguments

mapping, data

Standard layer overrides. Map the estimate to x, the study/subgroup to y, and the interval to xmin/xmax (via ymin/ymax, which are swapped for you). Map size to weight.

ref

Reference line position: 1 for ratios (default), 0 for mean differences, NA to omit.

color

Marker and whisker color.

linewidth

Whisker width.

Value

A Layer to add with +.

Examples

d <- data.frame(
  study = c("Trial A", "Trial B", "Trial C", "Pooled"),
  hr = c(0.82, 0.71, 0.95, 0.83),
  lo = c(0.65, 0.52, 0.78, 0.74),
  hi = c(1.03, 0.97, 1.16, 0.93),
  weight = c(30, 22, 28, 100)
)
ggnext(d, aes(hr, study, ymin = lo, ymax = hi, size = weight)) +
  geom_forest() +
  labs(title = "Hazard ratio by trial", x = "Hazard ratio (95% CI)", y = NULL)
#> <ggnext plot>
#>   data:  4 x 5
#>   aes:   x = hr, y = study, ymin = lo, ymax = hi, size = weight
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static