Contour-enhanced Forest Plot Example
# taking data from our paper published in Eur J Orthod
df <- data.frame(
study = c("Ulger 2006", "Cook 1994", "Zervas 2016", "Haralabakis 2003"),
year = c(2006, 1994, 2016, 2003),
n.e = c(12, 30, 22, 30),
mean.e = c(0.67, -0.28, -1.13, 24.9),
sd.e = c(0.65, 1.35, 1.69, 5.2),
n.c = c(12, 30, 19, 22),
mean.c = c(0.58, -0.63, -0.09, 23.4),
sd.c = c(0.79, 1.46, 1.89, 4.2)
)
# reaname mean , n and sd to our function
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
df <- df %>%
rename(
Study = study,
n_t = n.e,
mean_t = mean.e,
sd_t = sd.e,
n_c = n.c,
mean_c = mean.c,
sd_c = sd.c
)
library(contourforest)
# modifying values of position to have beautiful plot
forest_cont(df,
title = "FMA of cervical Headgear vs \n control group",
study_x = -6.5,
treatment_x = -4,
control_x = -2.5,
sort = "effect",
effect_x = 2,
weight_x = 4.5,
PredInt_x = 2,
contour_left_min = c(-1.3, -0.5, -0.2, 0),
contour_left_max = c(-0.5, -0.2, 0, 0.2),
contour_right_min = c(0, 0.2, 0.5, 0.8),
contour_right_max = c(0.2, 0.5, 0.8, 1.8),)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the contourforest package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `height` was translated to `width`.
## `height` was translated to `width`.
