My dataset is organized in this way:
factor <- c("group1", "group2", "group2")
X <- c("A", "B", "C")
V1 <- c(1:3)
V2 <- c(7:9)
V3 <- c(13:15)
df <- data.frame(factor, X, V1, V2, V3)
df
factor X V1 V2 V3
1 group1 A 1 7 13
2 group2 B 2 8 14
3 group2 C 3 9 15
I would like to represent a line chart where:
- The X axis represents X (A, B, C)
- The Y axis represents values from V1, V2, and V3
- I want to represent in a single chart these three lines, one per each variable (V1, V2, V3).
- I want to color parts of each line differently according to factor variable, so that a single line (V1 for instance) is partly represented by two colors (let's say red group1 and green group2).

plot,lines,ggplot2already?