I created a ggplot2 plot where I struggle with 2 things.
1) How to change the colors?
2) Why is the line missing between items 9 and 10?
cent <- rnorm(n=20, mean=5, sd=1)
num <- c(1:20)
groups2 <- c(rep("DSM Symptoms",9),rep("Non-DSM Symptoms",11))
data2 <- data.frame(num, cent, groups2)
ggplot(data2, aes(x=num, y=cent, fill=groups2, colour=groups2)) +
geom_line(color='#666666', size=0.7) +
geom_point() +
ylab('Strength Centrality') + xlab ('Symptoms') +
scale_x_reverse() +
scale_x_continuous(breaks = c(1:20)) +
coord_flip() +
theme_bw() +
theme(panel.grid.minor.y = element_blank())


fillin theaesif you want a single line.scale_color_manual(values=c("green","yellow"))If you want to change the colour of the dots to green and yellow for example.group = 1withingeom_line--geom_line(color='#666666', size=0.7, group = 1). You can usescale_color_manualto change the colors,scale_color_manual(values = c("green", "orange")).scale_x_reverseis getting overridden byscale_x_continuous. Use one or the other.