I have a dataset like this one :
df <- data.frame(Species = c("Sp A", "Other sp", "Other sp", "Other sp",
"Sp A", "Other sp", "Other sp"),
Study = c("A", "A", "A", "A",
"B", "B", "B"),
Value = c(1, 3, 4, 5, 3, 6, 7))
Looks like this :
> df
Species Study Value
1 Sp A A 1
2 Other sp A 3
3 Other sp A 4
4 Other sp A 5
5 Sp A B 3
6 Other sp B 6
7 Other sp B 7
I would like to compare the values of the species A to the values of the other species from a same study.
This is the plot I have now :
ggplot(df, aes(y = Value, x = Species)) +
geom_point(shape = 1) +
geom_line(aes(group = Study), color = "gray50") +
theme_bw()
I don't want the vertical lines. Instead of this, I would like to have 5 lines, 3 starting from the lower "Sp A" point toward the 3 corresponding "Other sp" points from the same study (A) and 2 starting from the upper "Sp A" toward the 2 other points from the same study (B).
