everyone, I encountered a problem, until now I don't resolve it. I want to make a plot as below, but I am just able to draw the right picture but the challenge is how to combine left and right to one picture. I wish someone could help me. I really appreciate it for you. Thanks.
left panel is importance variable and the right panel is parameter estimate plot. The order exists according to importance variable.
This is how to draw the right picture.
library(ggplot2)
df %>% ggplot(aes(x = Variables, y = Estimate, color = importance)) +
geom_hline( yintercept = 0, color = 'red', linetype = 'dashed', lwd = 0.5) +
geom_errorbar(aes(ymin = Estimate - lowerCI, ymax = Estimate + upperCI), width = 0, lwd = 1.5) +
coord_flip() +
geom_point(size = 4) +
scale_color_gradient(low="blue", high="red") +
scale_x_discrete(limits=c("AREA_MN_LAND","Semi_habitats_PLAND","SHDI_CROP"))
Here is my raw data.
df <-
structure(list(Variables = c("AREA_MN_LAND", "Semi_habitats_PLAND",
"SHDI_CROP"), Estimate = c(-0.463930572435947, 0.0937050717425011,
0.925024309144037), Std.Error = c(0.164850815862808, 0.0345256062907729,
0.556521436298426), lowerCI = c(-0.787032234349095, 0.0260361268681767,
-0.16573766262538), upperCI = c(-0.1408289105228, 0.161374016616825,
2.01578628091345), importance = structure(c(1, 1, 0.589768028982561
), n.models = c(AREA_MN_LAND = 2, Semi_habitats_PLAND = 2, SHDI_CROP = 1
), class = c("sw", "numeric"))), row.names = c(NA, -3L), class = "data.frame")

