I know this question has been answered before however, its not doing what I want it to do. I have a dataframe in R. And I want to make paired points between different categories. The dataframe is:
sample <- data.frame(city_name = c(rep('Wahsington',10),rep('Seattle',10)),
experience = rep(c("ten","five"),5),
test = rep(c('manager','manager','team lead','team lead',
'CFO','CFO','CEO','CEO','Executive',
'Executive'),2),
score = c(87.10,27.20,98.15,67.20,68.30,23.00,78.75,49.30,63.30,37.90,
69.10,20.20,90.65,56.05,69.40,47.35,52.55,37.85,
70.90,47.75))
And in order to draw paired points I do:
options(repr.plot.width=30, repr.plot.height=8)
ggplot(sample, aes(x = test, y = score, group = test)) +
geom_line() +
geom_point(size = 2, aes(color = experience)) +
facet_wrap(~ city_name) +
scale_x_discrete("") +
theme_minimal() +
ylab('Score') + xlab('') + theme(axis.text.x=element_text(angle = 90, hjust = 0))
The plot I get looks like:
However, I these paired point not to fall below one another but rather be a little tilted for aesthetics purposes as here but for different categories like 'CFO' and 'CEO' annotated on x-axis like in the first graph:
How can I achieve that using ggplot in R?
Edit: This is an example of what I want to achieve:





