# Cargar las librerías necesarias
library(ggplot2)
library(dplyr)
names(res)[1:3]<-c("min", "mean","max")
# Asumiendo que tu dataframe se llama df y tiene las columnas Variable, Mean, Lower y Upper
# Aquí hay un ejemplo de cómo podrías configurar tu dataframe:
# df <- data.frame(
# Variable = rep(c("Trait link", "Effect", "Tolerance", "Disism", "Inter(trait)", "Intra(trait)"), 3),
# Category = rep(c("Wood density", "SLA", "Maximum height"), each = 6),
# Mean = runif(18, 0, 0.2),
# Lower = runif(18, -0.3, 0),
# Upper = runif(18, 0.2, 0.5)
# )
# Crear la gráfica
p <- ggplot(res, aes(x = parameter, y = mean, ymin = min, ymax = max, color = water_status)) +
geom_hline(yintercept = 0, linetype = "dashed", color="grey55") + # Para agregar una línea horizontal en y = 0
geom_pointrange(position = position_jitterdodge(jitter.width = 0.0, dodge.width = 0.4)) +
coord_flip() +
facet_wrap(~trait, nrow=1) + # Para dividir en paneles basados en la categoría
theme_minimal() + # Tema minimalista
theme(axis.text.x = element_text(angle = 90, hjust = 1)) + # Rotar el texto del eje x si es necesario
labs(x = "", y = "Standardized coefficients") # Etiquetas para los ejes
# Mostrar la gráfica
print(p)