I am trying to make a lollipop plot that the dots show median/mean for each variable and the stick lines out of the dots show variance? The code that I wrote is this:
mydata <- df Avg = rowMeans(df) SD = apply(df, 1, sd) Above = ifelse(SD - Avg, TRUE, FALSE) df$NAME <- rownames(df) ggplot(df, aes(Avg, NAME, color = Above)) + geom_segment(aes(x = SD, y = NAME, xend = Avg, yend = NAME), color = "grey50") + geom_point()
and this is the output:
but I want sth like this image:
Can anyone help me?