Skip to content

Instantly share code, notes, and snippets.

@ConnorEsterwood
Last active November 27, 2024 23:11
Show Gist options
  • Select an option

  • Save ConnorEsterwood/4d123c178043f058d72f9e38bdf74ebc to your computer and use it in GitHub Desktop.

Select an option

Save ConnorEsterwood/4d123c178043f058d72f9e38bdf74ebc to your computer and use it in GitHub Desktop.
EI_forest<-plot_forest(out)
p <- plot_forest(EI_forest)$forest$`analysis id: 1`$moderated$individual_correction$ts
data_forest <- EI_forest$forest$`analysis id: 1`$moderated$individual_correction$ts$data
data_sorted <- data_forest %>%
arrange(yi)
dat <- data_sorted
p <- ggplot(dat, aes(y = reorder(cite, yi), x = yi, xmin = lowerci, xmax = upperci, shape = tester)) +
# Add data points and color them black
geom_point(color = 'black') +
# Add 'special' points for the summary estimates (diamonds)
geom_point(data = subset(dat, tester == 'Summary'), color = 'black', shape = 18, size = 1.5) +
# Add the CI error bars with specified height for horizontal lines
geom_errorbarh(height = 0.1) +
# Specify the limits of the x-axis and relabel it meaningfully
scale_x_continuous(limits = c(-1, 1), name = 'Effect size (r)') +
# Give the y-axis a meaningful label
ylab('Study') +
# Add a vertical dashed line indicating an effect size of zero
geom_vline(xintercept = 0, color = 'black', linetype = 'dashed') +
# Create sub-plots (facets) based on levels of 'setting'
# Allow each facet to have unique axes
facet_grid(setting ~ ., scales = 'free', space = 'free') +
theme(
panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
# Remove the legend by setting legend.position to 'none'
legend.position = "none"
)
# Display the plot
print(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment