79380234

Date: 2025-01-23 07:59:35
Score: 0.5
Natty:
Report link

You can try:

# Order df by log.est
df <- df[order(df$log.est, decreasing = TRUE), ]

# Add a color column for positive and negative values
df$color <- ifelse(df$log.est >= 0, "blue", "red")

# Forest plot
ggplot(df, aes(x = log.est, y = reorder(variable, log.est), xmin = log.lower, xmax = log.upper, color = color)) +
  geom_pointrange() +
  geom_vline(xintercept = 0, linetype = "dashed", color = "black") +
  scale_color_identity() +
  labs(title = "Forest Plot with Color-Coded Estimates",
       x = "Log Estimate",
       y = "Variable") +
  theme_minimal() +
  theme(axis.text.y = element_text(size = 10), axis.title.y = element_blank())

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jynxmaze