I hope that the points in the figure are horizontally dodged and then connected with lines
library(tidyverse)
d <- tibble::tribble(
~id, ~type, ~value,
1, "a", 2,
1, "b", 3,
1, "c", 4
)
# 1) All the points are aligned on a vertical line
d %>%
ggplot( aes(x = id, y = value) ) +
geom_point( )
# 2) dodged
d %>%
ggplot( aes(x = id, y = value) ) +
geom_point(
aes(group = type),
position = position_dodge(width = 0.7)
)
# 3) Connect these points
d %>%
ggplot( aes(x = id, y = value) ) +
geom_point(
aes(group = type),
position = position_dodge(width = 0.7)
) +
geom_line(
aes(group = id),
position = position_dodge(width = 0.7)
)
Here's what i expect
Looking forward to your assistance. Thanks