I am trying to recreate the graph that is provided by the function centralityPlot in qgraph. I got a dataframe that looks like this:
symptom structure(list(symptom = c("9", "8", "7", "6", "5", "4", "3",
"2", "1"), lower_bound = c(0.209023862993771, -0.656057911395765,
-0.144732954079441, -0.240150983834066, -2.09690619987396, -1.14713000698362,
-1.78304406354482, -1.31269792892215, -1.04552934099257), mean = c(1.35359542511945,
0.546873106351184, 0.787717966105717, 0.42221064177518, -1.18693181743255,
-0.284265955202698, -1.19008711707311, -0.377827032555581, -0.0712852170875892
), upper_bound = c(1.9749871489344, 1.54642345677796, 1.46727206716789,
1.10712439281518, -0.0748008645128608, 0.812125575894532, -0.510038969136605,
0.587753574399307, 0.981045133733119)), class = "data.frame", row.names = c(NA,
-9L))
it should look like a singular plot like this one
It's supposed to be doable in GGplot but so far What I've gotten is a complete mess:
temporal.dep.in.plot <- ggplot(temporal.dep.in, aes(x = symptom)) +
ylim(NA, 2.25) +
geom_errorbar(
aes(ymin = lower_bound, ymax = upper_bound),
width = 0.4,
color = "#56B4E9"
) +
geom_segment(
aes(y = lower_bound, yend = upper_bound, xend = symptom),
linetype = "solid",
color = "#2166AC",
size = 6
) +
geom_point(
aes(y = mean),
shape = 16,
size = 9,
color = "#D6604D"
) +
theme_classic() +
coord_flip() +
ylab("Z-scores") + xlab("Symptoms") +
theme(axis.text.y = element_text(
face = "bold",
colour = c(
"#ff0000",
"#ffaa00",
"#aaff00",
"#00ff00",
"#00ffaa",
"#00aaff",
"#0000ff",
"#aa00ff",
"#ff00aa"
),
size = 14
))
which honestly only works trough sheer force of will.
If that's too much, the main part that I'm trying to achieve right now is actually connecting the dots (mean) with a line, which so far has not been working with many methods that I've tried.