I am trying to visualize the output of meta-regression
in a forest plot. In this forest plot, xlab
shows the log response ratio while ylab
shows all the moderators (effect modifiers). However, the way how the moderators are shown in the forest plot doesn't look nice which is why I would like to rename them to make them visually good. Does anyone know how to rename these moderators in the forest plot? I used ggplot
to build the forest plot for meta-regression output. Below is the code I used to create the forest plot
head(output6_0b[[8]])
cutoff_lower = -1.5
cutoff_upper = 1.5
output6_ci_lb <- map(output6_0,
function(x) magrittr::extract2(x, "ci.lb") ) %>%
unlist()
output6_ci_ub <- map(output6_0,
function(x) magrittr::extract2(x, "ci.ub") ) %>%
unlist()
CI <- c(output6_ci_lb, output6_ci_ub)
plot1 = ggplot(output6_0b[[8]] %>%
mutate(ci.lb = ifelse(ci.lb < cutoff_lower,
cutoff_lower, ci.lb),
ci.ub = ifelse(ci.ub > cutoff_upper,
cutoff_upper, ci.ub)) ) +
geom_point(aes(y = name, x = estimate),
shape = 18, size = 5) +
geom_errorbarh(aes(xmin = ci.lb, xmax = ci.ub,
y = name), height = 0.25) +
geom_vline(xintercept = 1, color = "red",
linetype = "dashed", cex = 1, alpha = 0.5) +
# scale_x_continuous(limit = c(1.01*cutoff_lower, 1.01*cutoff_upper) ) +
xlab("Lnrr") +
ylab("") +
theme_bw() +
theme(panel.border = element_blank(),
panel.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"),
axis.text.y = element_text(size = 12, colour = "black"),
axis.text.x.bottom = element_text(size = 12, colour = "black"),
axis.title.x = element_text(size = 12, colour = "black"))